DATA Step, Macro, Functions and more

How can we put the big observation in same order with same spaces and lines in the word.

Accepted Solution Solved
Reply
Contributor
Posts: 27
Accepted Solution

How can we put the big observation in same order with same spaces and lines in the word.

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.

 


Accepted Solutions
Solution
‎09-05-2016 06:36 PM
Super User
Posts: 10,020

Re: How can we put the big observation in same order with same spaces and lines in the word.

Posted in reply to ramchinna24
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


All Replies
Solution
‎09-05-2016 06:36 PM
Super User
Posts: 10,020

Re: How can we put the big observation in same order with same spaces and lines in the word.

Posted in reply to ramchinna24
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;

Contributor
Posts: 27

Re: How can we put the big observation in same order with same spaces and lines in the word.

Thats awesome. Thank you for your help. 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 208 views
  • 1 like
  • 2 in conversation