BookmarkSubscribeRSS Feed
glee217
Calcite | Level 5

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);

5 REPLIES 5
PeterClemmensen
Tourmaline | Level 20

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;
ShiroAmada
Lapis Lazuli | Level 10
/* 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. 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;

 

PeterClemmensen
Tourmaline | Level 20

@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?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Quite true, too early in the morning Smiley Happy

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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