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.
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.
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.