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
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.
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.