Help using Base SAS procedures

SAS query

Reply
N/A
Posts: 0

SAS query

hello ,

Plz guide me.I want to save the data with the dropped varaibles.In the log window the dropeed varaibles dont exist , bur t when i save the data and run it in windows , the dropped variables exist , which i dont want when i open the SAS file " result.sas7bdat "

data sc.result;
set period1;
DateTimeofSale = DateofSale||":"||TimeofSale;
run;
proc print data = result(drop= DateofSale TimeofSale);
run;

kind regards ,

markc
SAS Super FREQ
Posts: 8,865

Re: SAS query

Posted in reply to deleted_user
In the code you show, you are creating a PERMANENT dataset in the SC library: SC.RESULT.

In your PROC PRINT, you have 2 issues:
1) you are printing just with a 1-level name -- which means that you are printing WORK.RESULT, not SC.RESULT. I assume you want to print the most current SC.RESULT. In a subsequent session, WORK.RESULT may not exist.

2) the DROP= option in the PROC PRINT only applies to WORK.RESULT and the display of the variables. The variables will still exist in the data set (whether in WORK or SC library).

If you want to permanently drop the variables from the SC.RESULT dataset, then you either need to use the DROP statement in your DATA step program or you need to use the DROP= option for SC.RESULT. Putting the DROP= in the PROC PRINT step will NOT drop the variables from the dataset.

cynthia
N/A
Posts: 0

Re: SAS query

Posted in reply to Cynthia_sas
Thankyou Cynthia.Kindly suggest me on this.I use the following code :

data result;
set period1;
DateTimeofSale = DateofSale||":"||TimeofSale;
DateofSale=datepart(DateTimeofSale);
SameDayDelivery=timepart(DateTimeofSale)<='15:00't;
drop= DateofSale TimeofSale;
proc print data = result;
run;

it doesnt give me the dateofsale and sameday delivery.The log -

323 SameDayDelivery=timepart(DateTimeofSale)<='15:00't;
324 drop= DateofSale TimeofSale;
----------
22

ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, <, <=, <>, =,
>, ><, >=, AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, ^=, |, ||,
~=.

NOTE: Character values have been converted to numeric values at the places given by: (Line)Smiley SadColumn).
322:29 323:34 324:15 324:26
NOTE: Numeric values have been converted to character values at the places given by: (Line)Smiley SadColumn).
322:20
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.RESULT may be incomplete. When this step was stopped there were 0
observations and 9 variables.
WARNING: Data set WORK.RESULT was not replaced because this step was stopped.
N/A
Posts: 0

Re: SAS query

Posted in reply to Cynthia_sas
the code i've used is -

data result;
set period1;
DateTimeofSale = DateofSale||":"||TimeofSale;
DateofSale=datepart(DateTimeofSale);
SameDayDelivery=timepart(DateTimeofSale)<='15:00't;
drop= DateofSale TimeofSale;
proc print data = result;
run;

but it doesnt give me the Sameday delivey and the dateofsale.

kindly guide.
markc
Super Contributor
Super Contributor
Posts: 3,174

Re: SAS query

Posted in reply to deleted_user
You have two related posts going, given this one is now piggy-backed with a second query/topic. Suggest you consolidate them and look here for a reply, suggesting DOC review once again:

http://support.sas.com/forums/thread.jspa?threadID=8817&tstart=0

Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 4 replies
  • 182 views
  • 0 likes
  • 3 in conversation