Hi.
In SAS EG my results are opened in the Output Window automatically. I like this.
In SAS EG using Proc SQL I can change the displayed variable output in the Output Window my specifying a format in the SELECT statement like this. By doing this the myNewDollar variable appears in the Output Window looking like $100.00.
proc sql;
create table Want as
select myDollar format dollar15.2 as myNewDollar
from Have;
quit;
However when using the SAS datastep in SAS EG, when the Output Window is populated the variable is not formatted as desired. It is display as 100.00 (without the $ sign)
data Want;
set Have;
format myNewDollar dollar15.2;
myNewDollar = myExistingDollar;
run;
I'm wondering if it's possible to get the variable output to the Output Window formatted using the data step without having to add additional Procs like a Proc Print?
Any help would be greatly appreciated.
When you say "output window" -- you meant the data grid view? This should be showing you the formatted data. If it works for PROC SQL then it will work for DATA step -- does not matter how the format is set.
Make sure that you're looking at the correct data source. It's possible that you're creating multiple different data sets, and looking at one that doesn't have the format applied.
When you say "output window" -- you meant the data grid view? This should be showing you the formatted data. If it works for PROC SQL then it will work for DATA step -- does not matter how the format is set.
Make sure that you're looking at the correct data source. It's possible that you're creating multiple different data sets, and looking at one that doesn't have the format applied.
I concur with @ChrisHemedinger. I just did a quick test, and it worked fine for me.
My test code:
data class;
set sashelp.class;
format NWeight dollar15.2;
NWeight = Weight;
run;
Tom
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.