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
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.