<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Columnize rows of data using SAS on the mainframe in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Columnize-rows-of-data-using-SAS-on-the-mainframe/m-p/23035#M5041</link>
    <description>Hello all,&lt;BR /&gt;
&lt;BR /&gt;
I'm a new SAS user on the mainframe.I have a dataset with rows of data. I need to format my output to be in columns. My current format is-&lt;BR /&gt;
000001      MAILBOX ID=COMPANY#1&lt;BR /&gt;
000002      BATCHID='DESCRIP#1'&lt;BR /&gt;
000003                     DSN=DATASETA&lt;BR /&gt;
000001      MAILBOX ID=COMPANY#2&lt;BR /&gt;
000002      BATCHID='DESCRIP#2'&lt;BR /&gt;
000003                     DSN=DATASETB&lt;BR /&gt;
&lt;BR /&gt;
Target Output-&lt;BR /&gt;
MAILBOX ID=COMPANY#1   BATCHID=DESCRIP#1   DSN=DATASETA         &lt;BR /&gt;
MAILBOX ID=COMPANY#2   BATCHID=DESCRIP#2   DSN=DATASETB&lt;BR /&gt;
&lt;BR /&gt;
Could someone assist me?  Thank you&lt;BR /&gt;
&lt;BR /&gt;
I</description>
    <pubDate>Thu, 23 Apr 2009 21:19:02 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-04-23T21:19:02Z</dc:date>
    <item>
      <title>Columnize rows of data using SAS on the mainframe</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Columnize-rows-of-data-using-SAS-on-the-mainframe/m-p/23035#M5041</link>
      <description>Hello all,&lt;BR /&gt;
&lt;BR /&gt;
I'm a new SAS user on the mainframe.I have a dataset with rows of data. I need to format my output to be in columns. My current format is-&lt;BR /&gt;
000001      MAILBOX ID=COMPANY#1&lt;BR /&gt;
000002      BATCHID='DESCRIP#1'&lt;BR /&gt;
000003                     DSN=DATASETA&lt;BR /&gt;
000001      MAILBOX ID=COMPANY#2&lt;BR /&gt;
000002      BATCHID='DESCRIP#2'&lt;BR /&gt;
000003                     DSN=DATASETB&lt;BR /&gt;
&lt;BR /&gt;
Target Output-&lt;BR /&gt;
MAILBOX ID=COMPANY#1   BATCHID=DESCRIP#1   DSN=DATASETA         &lt;BR /&gt;
MAILBOX ID=COMPANY#2   BATCHID=DESCRIP#2   DSN=DATASETB&lt;BR /&gt;
&lt;BR /&gt;
Could someone assist me?  Thank you&lt;BR /&gt;
&lt;BR /&gt;
I</description>
      <pubDate>Thu, 23 Apr 2009 21:19:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Columnize-rows-of-data-using-SAS-on-the-mainframe/m-p/23035#M5041</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-23T21:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: Columnize rows of data using SAS on the mainframe</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Columnize-rows-of-data-using-SAS-on-the-mainframe/m-p/23036#M5042</link>
      <description>I would say that you have to objectives to accomplish here, as follows:&lt;BR /&gt;
&lt;BR /&gt;
1) parse the input data using a DATA step and use a key variable to identify each unique "set" of rows (likely the first input data field as I see it).  Explore the use of the SAS INPUT statement in your DATA step to read the first and second character fields  (must use a RETAIN or better suggest using a DO UNTIL(EOF); / END loop instead to avoid the RETAIN stmt) and only increment the "set identifier" variable with each new input data field value "000001".  Sample DATA step:&lt;BR /&gt;
&lt;BR /&gt;
FILENAME INDATA "your_input_data_file_name";&lt;BR /&gt;
DATA ;&lt;BR /&gt;
INFILE INDATA ... END=EOF;&lt;BR /&gt;
DO UNTIL(EOF);&lt;BR /&gt;
  * your INPUT and data interpretation logic goes here;&lt;BR /&gt;
  * ;&lt;BR /&gt;
  * your SAS OUTPUT logic goes here. ;&lt;BR /&gt;
END;&lt;BR /&gt;
STOP;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
2) sort your SAS temporary file by the "set identifier" variable.&lt;BR /&gt;
&lt;BR /&gt;
3) explore using PROC TRANSPOSE to "horizontal-ize" your SAS temp file.&lt;BR /&gt;
&lt;BR /&gt;
4) use PROC PRINT or some other PROC or DATA step technique to generate your "Target Output" - the key point here is that you can list your "transposed" variables as a generic prefix in your VAR statement with PROC PRINT.  Sample PROC PRINT construct:&lt;BR /&gt;
&lt;BR /&gt;
OPTIONS NOCENTER LS=MAX;&lt;BR /&gt;
PROC PRINT U NOOBS...;&lt;BR /&gt;
  VAR your_transposed_variable_prefix:   ;  /* note the trailing colon char */&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
For consideration, the SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;   website has SAS-hosted documentation and also supplemental technical code samples and conference topic-oriented papers, related to these SAS programming and data transformation techniques.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Sat, 25 Apr 2009 16:53:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Columnize-rows-of-data-using-SAS-on-the-mainframe/m-p/23036#M5042</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-04-25T16:53:15Z</dc:date>
    </item>
  </channel>
</rss>

