BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Kurt_Bremser
Super User

So what fails here is a SQL join.

Your join creates a cartesian product, which can easily overwhelm your storage before the WHERE is applied. Consider replacing the SQL with a DATA step; a range of dates can easily be stored in an ARRAY through which you loop with a DO.

To help you with code, we need usable example (fake) data in data steps with datalines (DO NOT SKIP THIS!) and the expected resulting dataset.

Tom
Super User Tom
Super User

@Yanni_C wrote:

2. I want to split the dataset based on the different observations in 'characteristics', but I don't want to name the dataset using the name of the observations, I want to use dataset1, dataset2, dataset3,...


Then just name them that way.

Here is the step from the accepted answer:

%do i=1 %to &c;

 data &&typ&i;
 set have ;

Just change it to generate DATASET1, .... instead

%do i=1 %to &c;

 data dataset&i;
 set have ;
Ksharp
Super User

If your table was not big.

data have;
input cusip_id Name $10. date_issue :ddmmyy10. type $10.;
format date_issue ddmmyy10.;
datalines;
10343452 Zingas    01/04/2016 bench
10343489 Stephanie 01/04/2014 main
10343445 Olivia    01/04/2012 main
10343456 Amstel    01/04/2011 bench
10343457 KEO       01/04/2017 main
;
run;
proc freq data=have noprint;
table type/out=level nopercent;
run;
data _null_;
 set level;
 call execute(catt('data data_',type,';set have;if type="',type,'";run;'));
run;

 

georgel
Quartz | Level 8
Absolutely Clever Way using proc freq done by a sharp person! Only a few lines!
Thanks a million Ksharp!
I have tested it. Great. You know CREATIVITY= CLEVERNESS
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 18 replies
  • 4639 views
  • 16 likes
  • 9 in conversation