Hey guys, I'm stuck in a project. My code will only print 3 obs but I need it to print 5 as you can see the other two obs are aligned horizontally from the first and second lines of data. How do I make them print with the other 3 data lines without touching the data itself?
This is what it prints.
But I need it to print like this. Can someone please help me?
THANKS!
Split your DATALINES rows into 5 lines, after your date variable, then it will import and print correctly.
Lookup in the SAS Documentation for the INPUT statement what the @ can get used for.
Then adopt below sample to your code and data.
data test;
infile datalines dlm=',';
input a b @@;
datalines;
1,2
1,2,3,4,5,6
1,2,3,4
;
proc print data=test;
run;
There is no alignment required here. Just read the values.
If you want SAS to keep reading from the same line to get the next observation then use double trailing @ on the INPUT statement.
Also read the numbers as numbers, not strings.
And add formats to display the numbers the way you want. Avoid MDY or DMY ordering for dates as either choice will confuse half of your audience. Use YMD order or DATE format.
input price :comma. sqft tax date :anydtdte. @@;
format price dollar10.2 date yymmdd10.;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Ready to level-up your skills? Choose your own adventure.