Which programs correctly creates a series of macro variables whose - ProProfs Discuss
Advertisement

Which programs correctly creates a series of macro variables whose names are values of the data set variableCourse_code, then indirectly references one of those macro variables in a later step?

Asked by Moxleyv, Last updated: Apr 13, 2024

+ Answer
Request
Question menu
Vote up Vote down

1 Answer

moxleyv

moxleyv

moxleyv
Moxleyv

Answered Dec 13, 2018

Data _null_; set sasuser.courses; call symput(course_code, trim(course_title)); run; %let crsid=C005; proc print data=sasuser.schedule noobs label; where course_code="&crsid"; var location begin_date teacher; title1 "Schedule for &&&crsid"; run;

You can use multiple ampersands to create an indirect reference when the value of one macro variable is the name of another. If you enclose the DATA step variable name in quotation marks in the SYMPUT routine, the new macro variable will have the same name as the DATA step variable rather than having the DATA step variables value as a name. Use the SYMGET function to obtain the value of a macro variable during the execution of a DATA step.
upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.