Help using Base SAS procedures

what is wrong to import my code? :/

Reply
Occasional Contributor
Posts: 18

what is wrong to import my code? :/

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.

캡처.JPG

 

 

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 Star
Posts: 634

Re: what is wrong to import my code? :/

[ Edited ]

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;
Contributor
Posts: 68

Re: what is wrong to import my code? :/

[ Edited ]
/* 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. 

Super User
Super User
Posts: 7,565

Re: what is wrong to import my code? :/

[ Edited ]

Sorry, @draycut, 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;

 

PROC Star
Posts: 634

Re: what is wrong to import my code? :/

@RW9, I am aware that no import is going on. I did not mean to imply so Smiley Happy

 

Perhaps I am missing something here but don't you have to reference the stats301 library in your data step?

Super User
Super User
Posts: 7,565

Re: what is wrong to import my code? :/

Quite true, too early in the morning Smiley Happy

Ask a Question
Discussion stats
  • 5 replies
  • 128 views
  • 3 likes
  • 4 in conversation