BookmarkSubscribeRSS Feed
junya___08
Calcite | Level 5

I would like to ask for help because proc format does not work for some reasons. I think there is no syntax error and log does not show any errors and warnings.

The screenshot is the result of proc print statement AFTER assigning the format. Is there possible reason for it? What should I check to debug?

Screenshot 2025-07-13 at 19.50.18.png

proc format;
picture NewDate (default=19)
low-high = '%a.%B.%0d.%0y' (datatype=date);
run;

proc sort data=pg3.storm_final out=work.storm_final;
by descending StartDate;
run;

title 'Detail Storm Report by Descending Start Date';
proc print data=work.storm_final;
var Name BasinName StartDate EndDate MaxWindMPH MinPressure;
format StartDate EndDate NewDate.;
run;
title;
2 REPLIES 2
whymath
Barite | Level 11

I can get wanted result by your code. Maybe you need to restart yours SAS session to eliminate potential errors.1.jpg

 

Tom
Super User Tom
Super User

You did not describe why the output is wrong? 

 

Not sure what you mean by the statement:

The screenshot is the result of proc print statement AFTER assigning the format.

The code you shared does not attach the format to the variable in the dataset.  It only asks that the NEWDATE. format be used in the PROC PRINT step.  If you then try to print that dataset again without including the FORMAT statement again the date variables will print using whatever format was attached to them when they were copied from the permanent dataset in the PG3 libref to the temporary dataset in the WORK library by the PROC SORT step..

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

SAS Training: Just a Click Away

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

Browse our catalog!

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