Produce dataset, placing variables in specific columns (mainframe)
I have a work file with 4 variables, when using PROC PRINTTO SAS puts by variables in columns;
PROC PRINTTO PRINT = output;
PROC PRINT U DATA = final_report NOOBS;
VAR date dy job cc1;
Results;
The SAS System
date dy job cc1
12/19/16 MO PDMGCD97 00000008
12/19/16 MO PDMGHD68 00002947
Date starts in col 01
Dy starts in col 13
Job start is col 20
Cc1 start in col 32
Desired;
The SAS System
date dy job cc1
12/19/16 MO PDMGCD97 00000008
12/19/16 MO PDMGHD68 00002947
Date starts in col 01
Dy starts in col 11
Job start is col 15
Cc1 start in col 25
I can easily do this with DATA _NULL_ but I need to keep the work file. It is needed in the next step. I am using an empty check macro that needs that work file. I can also do this in a sort step but the results of the empty check put alternate text in the dataset and the sort OUTREC messes it up.
I ended figuring out how to use DATA _NULL_ to get the results I am lookign for. Thank you for the help
Sorry, why are you writing out a dataset to a text file, and then checking it with a macro? This:
proc printto print=output; run; proc print data=final_report nobs; var date dy job cc1; run;
Seems to be a bit of an odd, maybe old school approach to designing an output report. If the file is just used to check the dataset look at sashelp.vtable/vcolumn for meta data or explain your "checks".
If you need the file for people to use, then move to proc report, put titles in etc.
I ended figuring out how to use DATA _NULL_ to get the results I am lookign for. Thank you for the help
If I understand correctly, your problem with the data step is that you have a macro afterwards that uses the name of the last dataset created (stored in _LAST_ option and &SÝSLAST automatic macro variable).
No problem there, doing a DATA _NULL_ step does not change any of those two variables. At least not in the SAS version I am currently testing.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.