BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Zatere
Quartz | Level 8

Hello,

 

I have the following data:

data have;
input condition $ 1. _6  _5 _4 _3 _2 _1;
datalines;
A 14 14 8 0 0 0
B 3904 3918 3926 3926 3926 3926
C 910 917 917 917 918 922
D 1821 1816 1824 1825 1837 1824
E 5 2 2 2 3 3
F 1.8 1.8 1 0 0 0
;
run;

I then create dates formats:

 

DATA _NULL_;
CALL SYMPUT ('_6Day',PUT(today() - 6,DATE9.));
CALL SYMPUT ('_5Day',PUT(today() - 5,DATE9.));
CALL SYMPUT ('_4Day',PUT(today() - 4,DATE9.));
CALL SYMPUT ('_3Day',PUT(today() - 3,DATE9.));
CALL SYMPUT ('_2Day',PUT(today() - 2,DATE9.));
CALL SYMPUT ('_1Day',PUT(today() - 1,DATE9.));
RUN;

Then I create the report:

PROC REPORT DATA= have ; 
define _6 / display "&_6Day";
define _5 / display "&_5Day";
define _4 / display "&_4Day";
define _3 / display "&_3Day";
define _2 / display "&_2Day";
define _1 / display "&_1Day";
run;

have.JPG

However, when I change the dates formats then I don't get the desired output:

 

DATA _NULL_;
CALL SYMPUT ('_6Day',PUT(today() - 6,DDMMYY10.));
CALL SYMPUT ('_5Day',PUT(today() - 5,DDMMYY10.));
CALL SYMPUT ('_4Day',PUT(today() - 4,DDMMYY10.));
CALL SYMPUT ('_3Day',PUT(today() - 3,DDMMYY10.));
CALL SYMPUT ('_2Day',PUT(today() - 2,DDMMYY10.));
CALL SYMPUT ('_1Day',PUT(today() - 1,DDMMYY10.));
RUN;

PROC REPORT DATA= have ; 
define _6 / display "&_6Day";
define _5 / display "&_5Day";
define _4 / display "&_4Day";
define _3 / display "&_3Day";
define _2 / display "&_2Day";
define _1 / display "&_1Day";
run;

I get this:

have2.JPG

while I want to get the below:

 

Condition 30/12/2020 31/12/2020 01/01/2021 02/01/2021 03/01/2021 04/01/2021
A 14 14 8 0 0 0
B 3904 3918 3926 3926 3926 3926
C 910 917 917 917 918 922
D 1821 1816 1824 1825 1837 1824
E 5 2 2 2 3 3
F 1.8 1.8 1 0 0 0

 

It seems that the format DDMMYY10. changes how the report is displayed. Is there any way to fix it?

 

Thanks.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

The default SPLIT character for PROC REPORT is a slash.  Just tell it to use some other character to mark where you want it to insert line breaks.

PROC REPORT DATA= have split='ff'x; 
define _6 / display "&_6Day";
define _5 / display "&_5Day";
define _4 / display "&_4Day";
define _3 / display "&_3Day";
define _2 / display "&_2Day";
define _1 / display "&_1Day";
run;

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

Excel doesn't like the / character, it means line break in Excel. If you use a format with dashes or other separators, the problem goes away.

--
Paige Miller
Tom
Super User Tom
Super User

The default SPLIT character for PROC REPORT is a slash.  Just tell it to use some other character to mark where you want it to insert line breaks.

PROC REPORT DATA= have split='ff'x; 
define _6 / display "&_6Day";
define _5 / display "&_5Day";
define _4 / display "&_4Day";
define _3 / display "&_3Day";
define _2 / display "&_2Day";
define _1 / display "&_1Day";
run;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 1126 views
  • 1 like
  • 3 in conversation