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-
000001 MAILBOX ID=COMPANY#1
000001 MAILBOX ID=COMPANY#2
I would say that you have to objectives to accomplish here, as follows:
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:
FILENAME INDATA "your_input_data_file_name";
INFILE INDATA ... END=EOF;
* your INPUT and data interpretation logic goes here;
* your SAS OUTPUT logic goes here. ;
2) sort your SAS temporary file by the "set identifier" variable.
3) explore using PROC TRANSPOSE to "horizontal-ize" your SAS temp file.
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:
OPTIONS NOCENTER LS=MAX;
PROC PRINT U NOOBS...;
VAR your_transposed_variable_prefix: ; /* note the trailing colon char */
For consideration, the SAS support http://support.sas.com/ 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.