Help using Base SAS procedures

Updating a date in SAS

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 5
Accepted Solution

Updating a date in SAS


Hello: I am an SQL professional- brand new to SAS. I need to update just one row in SAS table. The datafield is a date type. I am just trying to update one row, set the field = "01Oct2015" where the id = xyz. The code runs and the value is set to a period. I know this must be a format issue. Could someone please help me?


Accepted Solutions
Solution
‎09-12-2014 02:59 PM
Trusted Advisor
Posts: 1,228

Re: Updating a date in SAS

Try this.

proc sql;

update have

set field='01Oct2015'd

where id='xyz';

quit;

View solution in original post


All Replies
Regular Contributor
Posts: 233

Re: Updating a date in SAS

data have;
input id date;
format date mmddyy10.;
informat date mmddyy10.;
cards;
1 10/25/2015
2 10/15/2015
3 10/10/2015
;
run;

data want;
set have;
if id ne 1 then date_new=put(date,mmddyy10.);
else date_new=put(date,date9.);
run;

proc print; run;

Solution
‎09-12-2014 02:59 PM
Trusted Advisor
Posts: 1,228

Re: Updating a date in SAS

Try this.

proc sql;

update have

set field='01Oct2015'd

where id='xyz';

quit;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 194 views
  • 0 likes
  • 3 in conversation