Help using Base SAS procedures

Help wanted - beginner

Reply
New Contributor
Posts: 3

Help wanted - beginner

Hello,

I'm new to this forum & new to SAS.
Somebody wrote me a procedure, but I do not get it to work.
It tells me, it cannot find the dataset.

Can you help me out?

Procedure:
/*
proc print data=wc.gi_det_total (obs=5);
run;
*/
data wc.wcwork;
set wc.gi_det_total (keep = hs_01 ap_06 nu_01 nu_02 et03 hc_04 hc_0201 hc_0202);
if ap_06 = 1 then pa1 = 1;else pa1 = 0;
if ap_06 = 2 then pa2 = 1;else pa2 = 0;
if nu_01 = 1 then wc1 = 1;else wc1 = 0;
if nu_01 = 2 then wc2 = 1;else wc2 = 0;
if nu_02 = 1 then bmi1 = 1;else bmi1 = 0;
if nu_02 = 2 then bmi2 = 1;else bmi2 = 0;
if nu_02 = 3 then bmi3 = 1;else bmi3 = 0;
if nu_02 in(1,2) then bmi = 1;
if nu_02 in(3,4) then bmi = 0;
bmiwc = bmi * nu_01;
bmiwc1 = bmi * wc1;
bmiwc2 = bmi * wc2;
run;

proc logistic data=wc.wcwork;
model hs_01 = ap_06 nu_01 nu_02 et03 hc_04 hc_0201 / rsq;
run;

Errors:
NOTE: SAS initialization used:
real time 1.71 seconds
cpu time 1.45 seconds

1 libname wc 'c:\temp';
NOTE: Libref WC was successfully assigned as follows:
Engine: V9
Physical Name: c:\temp
2 /*
3 proc print data=wc.gi_det_total (obs=5);
4 run;
5 */
6 data wc.wcwork;
7 set wc.gi_det_total (keep = hs_01 ap_06 nu_01 nu_02 et03 hc_04 hc_0201 hc_0202);

ERROR: File WC.GI_DET_TOTAL.DATA does not exist.
8 if ap_06 = 1 then pa1 = 1;else pa1 = 0;
9 if ap_06 = 2 then pa2 = 1;else pa2 = 0;
10 if nu_01 = 1 then wc1 = 1;else wc1 = 0;
11 if nu_01 = 2 then wc2 = 1;else wc2 = 0;
12 if nu_02 = 1 then bmi1 = 1;else bmi1 = 0;
13 if nu_02 = 2 then bmi2 = 1;else bmi2 = 0;
14 if nu_02 = 3 then bmi3 = 1;else bmi3 = 0;
15 if nu_02 in(1,2) then bmi = 1;
16 if nu_02 in(3,4) then bmi = 0;
17 bmiwc = bmi * nu_01;
18 bmiwc1 = bmi * wc1;
19 bmiwc2 = bmi * wc2;
20 run;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WC.WCWORK may be incomplete. When this step was stopped there were 0
observations and 14 variables.
WARNING: Data set WC.WCWORK was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.07 seconds
cpu time 0.06 seconds


21
NOTE: PROCEDURE LOGISTIC used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

Can someone explain me what to do?
Thanks in Advance!
Phi
Regular Contributor
Posts: 165

Re: Help wanted - beginner

Make sure the library reference is correct. Is the file really located in 'c:\temp' as indicated in this libname statement.

libname wc 'c:\temp';


Good luck!
New Contributor
Posts: 3

Re: Help wanted - beginner

Thanx, that did the trick!
Now, for something completely different:
I'm stuck with a table with 46 duplicates of each record.
Any idea how to sort that out?

All help is greatly appreciated, thanx! Message was edited by: Mephisto
Super Contributor
Super Contributor
Posts: 3,174

Re: Help wanted - beginner

Next time, create a new post for a new query.

Regarding your sort and duplicates, look at PROC SORT and using the DUPOUT= parameter.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

proc sort dupsout site:sas.com

sort duplicate observations separate file site:sas.com
Ask a Question
Discussion stats
  • 3 replies
  • 117 views
  • 0 likes
  • 3 in conversation