BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
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
deleted_user
Not applicable
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):(Column).
322:29 323:34 324:15 324:26
NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
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.
deleted_user
Not applicable
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
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1129 views
  • 0 likes
  • 3 in conversation