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
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.