Programming the statistical procedures from SAS

Retrieving tables from Proc X11

Reply
Contributor
Posts: 62

Retrieving tables from Proc X11

Hello SAS Community,

I'm using proc x11 to run a forecast on multiple areas. is there a way i can request specific tables for each area, with out typing out all areas?

For example, my current code looks something like this:

proc x11 data = have;

    monthly date = time_key;

    var   baton_rouge Cleveland    Connecticut;

    output out=want                            

               b1=baton_rouge_orig Cleveland_orig    Connecticut_orig   

               d11=baton_rouge_adj Cleveland_adj    Connecticut_adj;

run;

I tried using _all_ for the var statement and that worked but i can't figuire it out for specific tables

Thank you,

SAS Employee
Posts: 416

Retrieving tables from Proc X11

Hello -

You might consider reading all variable names into a macro variable and then run X11.

As an example (I'm not filtering out the DATE variable I know - but it might be a start):

%macro lst(dsn);

   %global x;

   %let x=;

   %let dsid=%sysfunc(open(&dsn));

   %let cnt=%sysfunc(attrn(&dsid,nvars));

   %do i = 1 %to &cnt;

      %let x=&x %sysfunc(varname(&dsid,&i));

   %end;

   %let rc=%sysfunc(close(&dsid));

%mend lst;

%lst(sashelp.workers)

proc x11 data=sashelp.workers noprint;

   monthly date=date;

   var &x;

   tables b1 d11;

   output out=out b1=&x d11=&x;

run;

Ask a Question
Discussion stats
  • 1 reply
  • 152 views
  • 3 likes
  • 2 in conversation