BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
buechler66
Barite | Level 11

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.

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

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.

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!

View solution in original post

3 REPLIES 3
ChrisHemedinger
Community Manager

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.

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!
TomKari
Onyx | Level 15

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

buechler66
Barite | Level 11
Yup, you are absolutely correct. Thanks for taking the time to identify my issue. I appreciate it.

SAS Innovate 2025: Register Now

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!

SAS Enterprise Guide vs. SAS Studio

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1956 views
  • 3 likes
  • 3 in conversation