BookmarkSubscribeRSS Feed
Imroze
Fluorite | Level 6

Hi,

I have a dataset with variable value containing Message information. When I read the Message from the text document I am appending the values from different observations and the complete text is comming in one line.

Is there any option in sas to display the message variable in (as in Excel we use alt + enter) more than one line as in header with split option.

The requirement is the data should be only in one variable and when right clicked should be able to view in excel in userfriendly format.

Please find the example below.

Input text document::::

x         y       z       Message: This is a sample message,

                             where I have to read the information in

                             one single variable in sas data set.

When I read this dataset the variable message comes in one line. say like the below

Message Variable

Message: This is a sample message, where I have to read the information in one single variable in sas data set.

But the issue here is to split the dataset value or set the column width or set the height of the variable value for display purpose or when

viewed by client in excel.

I have used byte(10) and concatenated the observations but does not work.

Thanks in advance.

3 REPLIES 3
Imroze
Fluorite | Level 6

Guys can any one please help in the above problem.  Please state wether it is possible or not.

Even if I have to export to Excel the solution will be helpful (alt + enter ) format.

Thanks in advance.

RichardinOz
Quartz | Level 8

This is a question about how long data items in a SAS dataset can be displayed in multiple lines.  It is not a question of how the data is stored 'under the covers' because it makes no sense in that context, either for SAS or Excel.

I doubt whether you can make the SAS data viewer behave in the way you describe but Proc report (and tabulate) can wrap data within fixed width cells.  An example from the SAS documentation:

proc format ;

   value questionf

   1='This is an example of a description that is too long so it wraps down to the next line';

run;

  

data a;

   input question rater $ avg;

   datalines;

1 manager 3

1 staff 2

1 peer 3

;

run;

  

ods listing close;

ods escapechar='^';

options nodate nonumber orientation=portrait;

proc report data=a nowd spanrows;

   column question rater avg;

   define question / order

                     format=questionf.

                     style(column)={cellwidth=2.2in};

   define rater / display;

   define avg   / display;

run;

(this comes from 9.2 documentation that describes an undesired side effect with ODS PDF:

45549 - Wrapped text strings in the first column cause unwanted white space in subsequent rows in PR...)


Richard

Imroze
Fluorite | Level 6

Thanks Richard

your comment is helpful in finalizing my decission..

As I can clearly specify to my client that dataset cannot be viewed directly in desired format, I can give a desired output if needed (ODS, EXCEL, HTML...).

Thanks again.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 504 views
  • 3 likes
  • 2 in conversation