BookmarkSubscribeRSS Feed
Kirito1
Quartz | Level 8
data work.shoes;
    infile "/folders/myfolders/import/shoes.csv"
	delimiter = ","
	missover 
	dsd
	firstobs=2;
 
	informat Region $50.;
	informat Product $50.;
	informat Subsidiary $50.;
	informat Stores best12.;
	informat Sales dollar12.;
	informat Inventory dollar12.;
	informat Returns dollar12.;
 
	format Region $50.;
	format Product $50.;
	format Subsidiary $50.;
	format Stores best12.;
	format Sales dollar12.;
	format Inventory dollar12.;
	format Returns dollar12.;
 
	input
	Region $
        Product $
	Subsidiary $
	Stores
	Sales
	Inventory
	Returns;
run;

I have two Questions regarding above Code.

1. What is the difference between best12. and dollar12. ?

2. Why are we putting $ sign in input statement?

Can give the summary of the code and answer 2 of the above Questions I have. 

Any help is appreciated.

Thanks in Advance 

 

Regards

1 REPLY 1
ballardw
Super User

The DOLLAR format displays  values with a national language currency symbol. The BEST format attempts to display a value in the given number of characters.

 

The input statement in this case does not need a $ because the INFORMAT statements indicate the variables are character. If you did not have an Informat or ATTRIBUTE statement indicating the values are to be character then the $ on the input would default to reading up to 8 characters into a character value.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 448 views
  • 0 likes
  • 2 in conversation