Hello Everyone :
The "Variable Lists" page describes you can "Passing Variable List Arguments", I want
to test Varlist statement usage, like this : (SAS 9.4M5 Win x64)
data class;
set sashelp.class;
run;
proc ds2;
data x(overwrite=yes);
/*dcl double age height weight;*/
dcl double y;
varlist vars [age height weight];
method varmean(varlist vars) returns double;
declare double rst;
rst = mean(of vars);
end;
method run();
set class;
y = varmean([age height weight]);
end;
enddata;
run;
quit;
then I got a "ERROR: Invalid variable list. vars is not a global scalar variable."
Do you know how to use it ,or some paper introduce it ?
Thanks!
Here you can find the page :
I must admit I've not used earliest before and I can't get it to work either. There are a couple of errors in your code though which won't help:
1. The variable height is misspelt in your varlist declaration; and
2. DS2 can't access the SASHELP library so you'll have to copy CLASS to another library before running the code
It might be worth raising a track with SAS for this as I can't see why it won't work as described in the documentation
Hi ChrisBrooks ,
Thank you for your feedback . I have fixed the Question and raising a track .
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.