BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Have 51 separate county datasets. Want to combine the 51 county datasets and create a variable "county name" based on the name of each dataset. Any suggestions?
3 REPLIES 3
Cynthia_sas
SAS Super FREQ
Hi:
You could "macro-ize" something like the program example below. It is always best, however to start with a basic non-macro program and understand how it works before you convert it to a macro program.

cynthia
[pre]
data new;
set sashelp.prdsale(in=prdsale)
sashelp.prdsal2(in=prdsal2)
sashelp.prdsal3(in=prdsal3);
if prdsale=1 then filename = 'SASHELP.PRDSALE';
else if prdsal2 = 1 then filename = 'SASHELP.PRDSAL2';
else if prdsal3 = 1 then filename = 'SASHELP.PRDSAL3';
run;

ods listing;
proc freq data=new order=data;
tables filename;
run;
[/pre]
Peter_C
Rhodochrosite | Level 12
if you have SAS92 use option INDSNAME= {VARname} see http://support.sas.com/kb/34/513.html .
Cynthia_sas
SAS Super FREQ
Thanks, Peter! I forget sometimes to point out the newer syntax.
cynthia

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!

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
  • 702 views
  • 0 likes
  • 3 in conversation