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

Data set: Have

P_NAME                     S_NAME                      ALINE_1                    ALINE_2

T1                                S1                                      A1                           D1

T2                                S2                                      A2                           D2

T3                                 S3                                     A3                           D3

Text file: Want

HDRXX XXXXX            20140829

P_NAME                     S_NAME                      ALINE_1                    ALINE_2

T1                                S1                                      A1                           D1

T2                                S2                                      A2                           D2

T3                                 S3                                     A3                           D3

My Code:

DATA _NULL_;
SET HAVE;
FILE "XXXX/want.txt"  lrecl=246;

IF _N_=1 THEN
  PUT @1   'HDR' @4   'XXX XXXXX' @25  "&FILE_DT." @33  213*' ';

IF _N_=2 THEN DO;
  PUT
  @1 'PNAME'
  @31 'SNAME'
  @61 'ALINE_1'
  @91 'ALINE_2'
 
END;

PUT
  @1 PNAME $30.
  @31 SNAME $30.
  @61 ALINE_1 $30.     

  @91 ALINE_2 $30.     ;
RUN;

My output: (line 2 and line 3 must revert)

HDRXX XXXXX            20140829

T1                                S1                                      A1                           D1

P_NAME                     S_NAME                      ALINE_1                    ALINE_2

T2                                S2                                      A2                           D2

T3                                 S3                                     A3                           D3

1 ACCEPTED SOLUTION

Accepted Solutions
1 REPLY 1
Hima
Obsidian | Level 7

I got the solution.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 634 views
  • 0 likes
  • 1 in conversation