Keep Drop statement (Prg2.1.5.11Lv2)

26 views
Skip to first unread message

Nisarg

unread,
Oct 7, 2014, 8:42:37 PM10/7/14
to anova...@googlegroups.com
Hi 
I m practicing SAS prog 2  Lesson1 Chapter 5 Practice 11 Level 2  (1.5.11 level 2) 
Can anyone explain the following : 
WARNING: The variable ShipDays in the DROP, KEEP, or RENAME list has never been referenced.
I m getting this msg after running the below code . 

data instore
delivery (keep = ShipDays);
keep order_id customer_id order_date;
set orion.orders;
where order_type=1;
ShipDays = Delivery_date-Order_date;
if ShipDays = 0 then output instore ;
else if ShipDays gt 0 then output delivery;
run;

The solution is using the keep stat. for both the dataset and its still doing giving the same warning.
The results dont match either. 
please send code or screenshot if differs from above code. 

Thanks 
Nisarg 
(batch4)

Jennifer SUN

unread,
Oct 8, 2014, 7:33:47 PM10/8/14
to anova...@googlegroups.com
data instore
 delivery (keep = ShipDays);
keep order_id customer_id order_date;

the keep option which is after delivery has not been referenced,

the second keep is the keep statement, it only keep the 3 variables as order_id customer_id order_date in both of your output, so the keep option did not referenced.

if your put the 2nd keep statement as keep option, you will get right answer.

Jennifer

Nisarg

unread,
Oct 8, 2014, 11:14:32 PM10/8/14
to anova...@googlegroups.com
Actually we dont need the output like that , we need 3 obs in data set one  and 4 in second dataset.  
 I have attached the Practice page. 


Screenshot (56).png

Nisarg

unread,
Oct 8, 2014, 11:16:19 PM10/8/14
to anova...@googlegroups.com
BY MISTAKE I MENTIONED "OBS" INSTEAD OF  '"VARIABLES"' 
Actually we dont need the output like that ,
 we need 3 VARIABLES  in first dataset  and 4 VARIABLES in second dataset.  

Jennifer SUN

unread,
Oct 9, 2014, 11:23:22 PM10/9/14
to anova...@googlegroups.com
HI Nisarg,

Sorry, I did not get what you try to say. the delivery dataset only has order_id customer_id order_date  so your sas program cannot find variable shipdays.

the code should like following:

data instore (keep=order_id customer_id order_date)
 delivery (keep =  order_id customer_id order_dateShipDays);
Jennifer


Reply all
Reply to author
Forward
0 new messages