BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Dear All,

I'm having nearly 100 sas datasets with naming convention as sample1, sample2, sample3, etc...Variables are common in all the SAS datasets
how to combine all this ?
5 REPLIES 5
Patrick
Opal | Level 21
data all;
set sample1 - sample;
run;


or as data step view avoiding to duplicate data:

data all /view=all;
set sample1 - sample;
run;
Peter_C
Rhodochrosite | Level 12
Patrick offers the best solution which is valid since SAS9.2. Before this release we needed to list each of the datasets on a set statement.
Another good feature of SET statement added in SAS9.2 is the option INDSNAME=.
This names a variable that indicates from which of the datasets on the statement the current observation has come.

PeterC
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Also, new with SAS 9.2, the SET statement can specify a file-prefix (stem), such as:

SET XXXYYY: ;

Very helpful with avoiding the need to code NODSNFERR when you are not sure how many "cycles" or "versions" of a given file are available to select.

Scott Barry
SBBWorks, Inc.
Patrick
Opal | Level 21
INDSNAME= !!!

Why didn't you tell me earlier! 🙂

It's only 2 weeks ago that I ended up doing some complicated coding because I missed this 9.2 enhancement to the set statement.

Thanks for this info Peter. That will come in very handy (also: I should now amend my code...)

Cheers
Patrick
DanielSantos
Barite | Level 11
Quite a lot of great and interesting new features, thanks for the info!

Since I'm still "stuck" at work with the 9.1.3, here's the alternative:
[pre]
proc sql noprint;
select catx('.',LIBNAME,MEMNAME) into: TABS separated by ' ' from DICTIONARY.TABLES
where LIBNAME='' and MEMNAME like '%';
quit;
%put &TABS;

data ALL;
set &TABS;
run;
[/pre]
Cheers from Portugal.

Daniel Santos @ www.cgd.pt

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
  • 5 replies
  • 751 views
  • 0 likes
  • 5 in conversation