BookmarkSubscribeRSS Feed
NewmanChow
Fluorite | Level 6

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 :

http://documentation.sas.com/?docsetId=ds2pg&docsetTarget=p1ko0gchlvwonyn173udvwbvspks.htm&docsetVer...

 

3 REPLIES 3
ChrisBrooks
Ammonite | Level 13

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

NewmanChow
Fluorite | Level 6

Hi  ChrisBrooks ,

    Thank you for your feedback . I have fixed the Question and raising a track .

 

NewmanChow
Fluorite | Level 6
Here is SAS Technical Support feedback:
“On the issue, our developer fedback

The DS2 variable list was developed to fulfill a need of DS2 C packages, and it has very limited functionality supporting native DS2 packages and methods. Currently, functionality is NOT provided to extract values from the variables in a variable list in DS2 code.”

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1034 views
  • 0 likes
  • 2 in conversation