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

Hi,

    Can anyone help me out please?

    I have following data set:
    data have;
    id    name country
    100   abc   ind   


just for understanding clearly, 4th column is comments, I am adding below

comments:
"SWIFTT LIST BRUPI
ACTION REQUIRED: REASSESS ASUP TO PICKUP INCM
Refer to note dated 21/07/2016 entered by TDEMP003.
ACTION TAKEN:  I have reassessed Asupp based on the income from 25/07/2016. Asupp rate is now $69.00 ($34.50 each).
Outcome of call to client No
Letter sent: Yes

Client Number                                                                       357-208-501
Entitlement Date                                                                25/07/2016 

Gross SA                                                             $-  
Gross Wages                                                          $823.31
Extra Income from Assets                                         $-  
TOTAL GROSS INCOME                                               $823.31


so there are 4 columns.

i want the result in word like this;

             id       100
       name       abc
    country        ind

comments    "SWIFTT LIST BRUPI
                     ACTION REQUIRED: REASSESS ASUP TO PICKUP INCM
                    Refer to note dated 21/07/2016 entered by TDEMP003.
                   ACTION TAKEN:  I have reassessed Asupp based on the income 
                   25/07/2016. Asupp rate is now $69.00 ($34.50 each).
                   Outcome of call to client No

                    Letter sent: Yes

 


                  Client number 12345

                   Entitlement
                    Date 25/07/2016                                                    

               Gross SA                                                            
              Gross Wages                                                             $823.31
              Extra Income from Assets                                            $-  
             TOTAL GROSS INCOME                                            $823.31

 

I tried with following code:

data null; set client_details;

    file " &WORK_DIR_PATH/&filename..doc" noprint lrecl=1200 print;
           put 'ID' @ 30 id /;
           put 'Client name' @30 Name /;
           put 'country' @30 country /;
           put 'comments' @30 comments ;

; run;

I am looking here for 'comments' field (4th column). i could not arrange them in order exactly that shows in the field. my reuslts are looking ugly. I mean the words and numbers are not showing in same order as in the table. so can anyone please tell how to write that big observation into multiple lines or exctly how it is showing the row.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
You should post it at ODS Report forum.



options noquotelenmax;
data have;
id=1;
name='aaa';
country='bbb';
comments=
"SWIFTT LIST BRUPI ~n
ACTION REQUIRED: REASSESS ASUP TO PICKUP INCM ~n
Refer to note dated 21/07/2016 entered by TDEMP003. ~n
ACTION TAKEN:  I have reassessed Asupp based on the ~n
income from 25/07/2016. Asupp rate is now $69.00 ($34.50 each). ~n
Outcome of call to client No ~n
Letter sent: Yes ~n
~n
Client Number      ~_~_~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_                                                                  357-208-501 ~n 
Entitlement Date           ~_~_~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_                                                       25/07/2016  ~n
~n
Gross SA                     ~_~_~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_                                          $-   ~n
Gross Wages                  ~_~_~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_                                          $823.31  ~n
Extra Income from Assets       ~_~_~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_                                    $-   ~n
TOTAL GROSS INCOME             ~_~_~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_                                    $823.31 ~n "
;
run;
data temp;
 set have;
 length vname $ 20 value $ 32767;
 vname='id';value=id;output;
 vname='Client Name';value=name;output;
 vname='Country';value=country;output;
 vname='Comments';value=comments;output;
keep vname value;
run;
 
ods escapechar='~';
proc report data=temp nowd style={frame=void rules=none} noheader;
run;

View solution in original post

2 REPLIES 2
Ksharp
Super User
You should post it at ODS Report forum.



options noquotelenmax;
data have;
id=1;
name='aaa';
country='bbb';
comments=
"SWIFTT LIST BRUPI ~n
ACTION REQUIRED: REASSESS ASUP TO PICKUP INCM ~n
Refer to note dated 21/07/2016 entered by TDEMP003. ~n
ACTION TAKEN:  I have reassessed Asupp based on the ~n
income from 25/07/2016. Asupp rate is now $69.00 ($34.50 each). ~n
Outcome of call to client No ~n
Letter sent: Yes ~n
~n
Client Number      ~_~_~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_                                                                  357-208-501 ~n 
Entitlement Date           ~_~_~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_                                                       25/07/2016  ~n
~n
Gross SA                     ~_~_~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_                                          $-   ~n
Gross Wages                  ~_~_~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_                                          $823.31  ~n
Extra Income from Assets       ~_~_~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_                                    $-   ~n
TOTAL GROSS INCOME             ~_~_~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_ ~_                                    $823.31 ~n "
;
run;
data temp;
 set have;
 length vname $ 20 value $ 32767;
 vname='id';value=id;output;
 vname='Client Name';value=name;output;
 vname='Country';value=country;output;
 vname='Comments';value=comments;output;
keep vname value;
run;
 
ods escapechar='~';
proc report data=temp nowd style={frame=void rules=none} noheader;
run;

ramchinna24
Obsidian | Level 7

Thats awesome. Thank you for your help. 

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