BookmarkSubscribeRSS Feed
toshi
Fluorite | Level 6

I have one date variable in sas viya report and currently it has default format date9.

I want to show that same variable in DDMMYY6. format (proper date format).

 

Example, if the date is 30Dec2019 then it should look like 30122019.

 

I tried using parse function and giving required format but the result is in character format and which is not required in my case, since I want to use that variable in bar graph and proper sorting is not possible in character variable.

 

Thanks in advance !!!

3 REPLIES 3
PaigeMiller
Diamond | Level 26

Parsing is not necessary. Just change the format.

 

format variablename ddmmyy6.;
--
Paige Miller
toshi
Fluorite | Level 6

Hello @PaigeMiller ,

 

I already tried same, but still the format is not there. If try to apply the format DDMMYY6. then its giving character variable as a result.

I want variable in proper date format (DDMMYY6.) so that it can be sorted properly in bar chart or line chart.

Please refer the  following screenshots:

 

image.pngimage.png

 

 

 

 

 

 

 

 

 

PaigeMiller
Diamond | Level 26

I'm afraid I don't understand. Changing a format on a numeric variable will result in a numeric variable yet you say it is giving a character variable. This means the variable is not numeric, it is character. SHOW US what you see and why you think the variable is numeric and why you think the result is character. SHOW US.

 

The DDMMYYYY format is shown in the screen capture.

 

If your variable is really numeric, then it should sort in proper date order without parsing and without a need to change the format.

--
Paige Miller