Hi
I want to import my .sas7bdat file and make some temporary data with only where it is CURRENT_BALANCE < 0
i attached the result of picture about proc print as well.
Here's code:
/* This is the STATS301 start up file */
*Set up title on line 1;
TITLE1 "STATS 301 / 749750841 / glee217 : &sysuserid";
*Specify SAS library for storing permanent SAS datasets;
LIBNAME stats301 "C:\Users\olivi\Desktop\301assn3";
**import .sas7bdat;
proc print data="C:\Users\olivi\Desktop\301assn3\account_level_ds.sas7bdat";
run;
data nonnegative;
set temp(where=current_balance>0);
run;
And here's error.
82 /* This is the STATS301 start up file */
83 *Set up title on line 1;
84 TITLE1 "STATS 301 / 749750841 / glee217 : &sysuserid";
85 *Specify SAS library for storing permanent SAS datasets;
86 LIBNAME stats301 "C:\Users\olivi\Desktop\301assn3";
NOTE: Libref STATS301 was successfully assigned as follows:
Engine: V9
Physical Name: C:\Users\olivi\Desktop\301assn3
87
88 **import .sas7bdat;
89 proc print data="C:\Users\olivi\Desktop\301assn3\account_level_ds.sas7bdat";
90 run;
NOTE: No observations in data set C:\Users\olivi\Desktop\301assn3\account_level_ds.sas7bdat.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
91
92
93 data nonnegative;
94 set temp(where=current_balance>0);
PROC PRINT does not import your dataset. Do like this
libname stats301 "C:\Users\olivi\Desktop\301assn3\";
data nonnegative;
set stats301.account_level_ds(where=(current_balance>0));
run;
proc print data=nonnegative;
run;
/* This is the STATS301 start up file */
*Set up title on line 1;
TITLE1 "STATS 301 / 749750841 / glee217 : &sysuserid";
*Specify SAS library for storing permanent SAS datasets;
LIBNAME stats301 "C:\Users\olivi\Desktop\301assn3";
**import .sas7bdat;
proc print data="C:\Users\olivi\Desktop\301assn3\account_level_ds.sas7bdat";
run;
data nonnegative;
set temp;
where current_balance>0;
run;
Same effect.
Sorry, @PeterClemmensen, and OP, there is no "import" going on here. You have a SAS dataset which is in the Windows folder:
C:\Users\olivi\Desktop\301assn3
Therefore to access this datafile you just need the libname to create the reference the area and then use the data:
libname stats301 "C:\Users\olivi\Desktop\301assn3";
data nonnegative;
set stats301.account_level_ds (where=(current_balance > 0));
run;
@RW9, I am aware that no import is going on. I did not mean to imply so 🙂
Perhaps I am missing something here but don't you have to reference the stats301 library in your data step?
Quite true, too early in the morning
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.