BookmarkSubscribeRSS Feed
dooheekim01
Obsidian | Level 7

data storm_new;

set pg1.storm_damage;

drop Summary;

YearsPassed=yrdif(Date, today(), "age");

Anniversary=mdy(month(Date), day(Date), year(today()));

format YearPassed 4.1 Date Anniversary mmddyy10.;

format Cost dollar20. YearPassed 4.;

run;

 

YearPassed 4. didn't work. 

Still it shows like this "

15.084931507

 

I don't know why "YearPassed 4." didn't work in the statement. Please help me. 

4 REPLIES 4
ballardw
Super User

Where does the value show like that?

 

Is that supposed to be output from Proc Print? The SAS table viewer?

 

Or did you export the data to an external file? If so which one and what code did you use to export it?

dooheekim01
Obsidian | Level 7
Hello,

Yes! the value shows like this and this is in the SAS table view.

This statement was the one of the activities. (Lesson 4 - SAS Programming 1)
Thank you!
ballardw
Super User

Check your dataset properties to see if the format for the variable is as you expect it.

 

Proc contents data=storm_new.

run;

 

If that does not show a 4. format then check your logs to make sure the data set was created. Or that you are opening the correct data set.

dooheekim01
Obsidian | Level 7

Thank you!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 873 views
  • 1 like
  • 2 in conversation