BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ian_Tfirn
Calcite | Level 5

Works perfectly, thanks for your help!

Reeza
Super User
@heffo, use the TRIMMED option in PROC SQL to avoid the need to get rid of extra spaces issue. You should also remove the quotes from the text comparison.
ballardw
Super User

I would also suggest using DICTIONARY.COLUMNS in stead of SASHELP.VCOLUMN in Proc SQL. I notice very different performance, seconds versus minutes, with the number of libraries, datasets and variables involved on my system.

 

Since the OP says that his datasets have "hundreds of variables" this performance might be noticeable.

Reeza
Super User
The difference matters with the number of data sets and libraries, not columns. If that was the case I'd switch to use PROC CONTENTS or FUNCTIONS. The difference between dictionary and sashelp doesn't exist anymore the last time I tested it.
Kurt_Bremser
Super User

I also have the experience that @Reeza commented on. With time, SAS seems to have gotten much better at handing over where conditions through the SASHELP.Vxxxxxx views.

In earlier times, I would have the same problems with very bad performance of SASHELP:VTABLE or SASHELP.VCOLUMNS, but now (9.4 M5) there's no noticeable difference.

heffo
Pyrite | Level 9
At one time or another I had some problems with missing values and quotes. So, I started to use the quotes to help this. I don't know if this is the best way to do it.
It might have been when having x ne &y or similar and not the = .
gamotte
Rhodochrosite | Level 12

Hello,

 

%macro freq_means(lib, mem, var);
    data _NULL_;
        set &lib..&mem.;

    if vtype(&var.)="C" then call execute('proc freq data=&lib..&mem.; table &var.; run;');
    else call execute('proc means data=&lib..&mem.; var &var.; run;');

    stop;
    run;
%mend;

%freq_means(sashelp, class, NAME);
%freq_means(sashelp, class, age);

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 21 replies
  • 1352 views
  • 6 likes
  • 6 in conversation