Hi,
I am rewriteing a sas program based on other people's work. Do not understand macro variable call in a macro. Can somebody help me out? Thanks!
%macro medianrange(trt=,var=,ord=,subord=,param=,varfmt=); proc means data=adsl nway maxdec=2 noprint; where trt01pn=&trt.; var &var.; format &var. &varfmt.; output out=stat&var._ min = min median = median max = max n=n mean=mean std=sd /*q1=q1 q3=q3*/; run; ....
The macro variable "var &var." is called in a macro. Why put "." after the &var?
The period after &var is optional in this situation. It indicates the end of the macro variable name (in other words, the macro variable name is the three letters var). This might be needed in other situations, for example if you want to use &var followed by other text, so you want the value of &var followed by the text string _method2, you would use &var._method2. The period after &var in the OUTPUT statement is required, in order to indicate the end of the ename of the macro variable; and so the output data set is the name STAT followed by the value of &var followed by _
The period after &var is optional in this situation. It indicates the end of the macro variable name (in other words, the macro variable name is the three letters var). This might be needed in other situations, for example if you want to use &var followed by other text, so you want the value of &var followed by the text string _method2, you would use &var._method2. The period after &var in the OUTPUT statement is required, in order to indicate the end of the ename of the macro variable; and so the output data set is the name STAT followed by the value of &var followed by _
Thank PaigeMiller! much appreciated.
Best,
John
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.