New SAS User

Completely new to SAS or trying something new with SAS? Post here for help getting started.
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
librasonali
Quartz | Level 8

Hi ,

 

I have attached my code where I am taking value of a field which has latest datetime sorted by account and datetime field . But i am contentiously getting ERROR: File WORK.ALL.DATA does not exist. 

if I put

 

data all;
set rpl_dcf;
by WS_ACCT_NUM;
if last.WS_ACCT_NUM ;

 

code before sorting then obviously it will say your variables are not sorted something. 

Please help that's what is an issue? 

Help will be appreciated. 
I have attached log message too . 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

You can't sort ALL because it hasn't been created yet. Try sorting the rpl_dcf data, like this:

 

Proc sort data =rpl_dcf;
   by WS_ACCT_NUM WS_EMAIL_ADDR_LAST ;
run;

View solution in original post

5 REPLIES 5
Rick_SAS
SAS Super FREQ

You can't sort ALL because it hasn't been created yet. Try sorting the rpl_dcf data, like this:

 

Proc sort data =rpl_dcf;
   by WS_ACCT_NUM WS_EMAIL_ADDR_LAST ;
run;
librasonali
Quartz | Level 8

thanks Rick !
right i did sort rpl_dcf and it worked . one more doubt
is there any difference in 

 

data rpl_dcf;
set rpl.rplcandcf_eaddr083020
rpl.rplcandcf_eaddrpii083020;
run; 

 

or 

 

data rpl_dcf;
set rpl.rplcandcf_eaddr083020; 
set rpl.rplcandcf_eaddrpii083020;
run;

Tom
Super User Tom
Super User

If you use one SET statement

set rpl.rplcandcf_eaddr083020 rpl.rplcandcf_eaddrpii083020;

it reads the datasets in the order. So first it reads the observations from the first one, then it reads those from the second one.

If you use two SET statements

set rpl.rplcandcf_eaddr083020 ;
set rpl.rplcandcf_eaddrpii083020;

it reads one observation from each dataset on each iteration of the data step.

So if the two datasets have N and M observations then the first will yield N+M observations and the second will yield the MIN(N,M) observations.

librasonali
Quartz | Level 8
i got it that a combination of the two data sets would form a single observation in the new data set.
thank you !

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 3647 views
  • 3 likes
  • 4 in conversation