I want to identify the max value of one variable among all identical datasets (have same variables in each dataset) created and saved under work and exact the row. But got a note:
NOTE: A stored DATA STEP view cannot run under a different operating system.
data allscan/view = allscan;
set optimal_:indsname=dsname;
run;
proc sql;
create table min as
select * from allscan
having EN=min(EN);
quit;
NOTE: DATA STEP view saved on file WORK.ALLSCAN.
NOTE: A stored DATA STEP view cannot run under a different operating system.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
ERROR: The following columns were not found in the contributing tables: EN.
NOTE: View WORK.ALLSCAN.VIEW used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
A Note is just a note, it doesn't signal an error. The error seems to be that at least one of your WORK.OPTIMAL_* datasets doesn't include a variable called EN. - PG
I used the %sysfunc to check the nobs and delete it if it is empty. But it seems that the empty datasets were still there.
%do i = 2 %to &maxN;
%joint(&i,&i); *** create table optimal_&i;
*** check if the data is empty;
%LET dsid=%SYSFUNC(OPEN(work.optimal_&i));
%LET nobs=%SYSFUNC(ATTRN(&dsid.,NOBS));
%LET rc=%SYSFUNC(CLOSE(&dsid.));
%IF &Nobs. EQ 0 %THEN %DO;
proc datasets;
delete optimal_&i;
run;
%END;
%end;
data allscan/view = allscan;
set optimal_:indsname=dsname;
run;
proc sql;
create table opt as
select * from allscan
having EN=min(EN);
quit;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.