BookmarkSubscribeRSS Feed
td1234
Calcite | Level 5

Is there an option to only keep variables referenced in a program?  I would like to shrink a large dataset but would prefer not to have to identify 50-80 variables everytime I start a new analysis. 

4 REPLIES 4
Astounding
PROC Star

There isn't such an option.  However, you might be able to lessen the workload.  Instead of naming 50 to 80 variables toward the end of the program, you might be able to keep just 20 or 30 variables at the beginning of the program.  Those would be kept, along with all variables that are calculated by executing the program.

 

Without more specifics about what the program does, it's difficult to give more specific suggestions.

 

If the variables you are keeping have recognizable patterns to their variable names, additional possibilities exist.  For example, it's easy to keep all variables where the variable name begins with "var_".

td1234
Calcite | Level 5

Thanks. What is the syntax for keeping all var that start with "var_"?

Reeza
Super User

Use the colon operator to specify a prefix.
Keep var_:;

Use a list for variables that are sequentially labelled.
Keep var1-var100;

Use -- to keep variables that are side by side. All variables in between the two variables listed are kept.

keep var1--middle_var;

 

The documentation details it better than I can, as usual:

http://support.sas.com/documentation/cdl/en/lrcon/68089/HTML/default/viewer.htm#p0wphcpsfgx6o7n1sjtq...

 

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 772 views
  • 1 like
  • 4 in conversation