I would like to read data as shown in the excel file and display the same as output, what is the easiest way to do that.
For example,
data have;
infile datalines dlm="#";
input Disease $ Description $;
datalines;
Atrial Flutter # Atrial flutter (AFL) is a common abnormal heart rhythm that starts in the atrial chambers of the heart. When it first occurs, it is usually associated with a fast heart rate and is classified as a type of supraventricular tachycardia.
Tachycardia # Tachycardia is a condition that makes your heart beat more than 100 times per minute. There are three types of it: Supraventricular. This happens when the electrical signals in the organ's upper chambers misfire and cause the heart rate to speed up. It beats so fast that it can't fill with blood before it contracts.
;
run;
Main issue is with the text wrapping since it reads as one long line of text which I want it to be spread across multiple lines just as in excel file.
The output of sas dataset should like the one attached in excel file (The text should wrap just as in the excel file )
Let suppose that description is up to 130 characters long and you want to print a column of 30 characters each
without breaking a word:
data want;
length description $130 column $30;
set have;
flag=1;
do until flag=0;
column = substr(description,1,30);
pos = index(column, ' ', -1); /* last space in column */
if column ne ' ' and pos ne 0 then
do; column = substr(column,1,pos-1);
description = substr(description,pos+1); /* rest of description */
output;
end;
if description = ' ' then flag=0; /* no more text to subtract */
end;
drop description;
run;
code was not tested. use it as a base to split the description.
PROC REPORT will flow the long values for you.
proc report data=have nofs headline;
column disease description;
define disease / order ;
define description / display flow width=50;
run;
SAS 9.4 on WINDOWS 08:30 Friday, December 27, 2019 1 Disease Description ----------------------------------------------------------------------------- Atrial Flutter Atrial flutter (AFL) is a common abnormal heart rhythm that starts in the atrial chambers of the heart. When it first occurs, it is usually associated with a fast heart rate and is classified as a type of supraventricular tachycardia. Tachycardia Tachycardia is a condition that makes your heart beat more than 100 times per minute. There are three types of it: Supraventricular. This happens when the electrical signals in the organ's upper chambers misfire and cause the heart rate to speed up. It beats so fast that it can't fill with blood before it contracts.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.