BookmarkSubscribeRSS Feed
Sathya3
Obsidian | Level 7

I want to read below column from input file and display them in the format specified..I want to write the sas format with below information .

 

column    datatype       logical_datatype        length        format

ccy_ccd      string                   text                           3                $3.00

--------

PROC SQL;

create table template (

ccy_ccd char(3) format=??

);

 

quit;

5 REPLIES 5
maguiremq
SAS Super FREQ

So the value would contain dollar amounts?

 

Any reason it isn't numeric?

Sathya3
Obsidian | Level 7

It looks like a currency code..rather than a number

Tom
Super User Tom
Super User

To store up to three bytes you need to define the variable to have a LENGTH of 3. 

 

Attaching a format to it is not that important. Formats are special instructions for printing/displaying the values.  You do not need to give SAS any special instructions for displaying normal character values.  But if you did want to attach a format (perhaps to remove a mistakenly attached format since PROC SQL has no syntax for removing formats from variables) then just use the normal $ format with a width of 3. 

Character formats do not allow for decimal places (what would it even mean?) so it is not clear why your description has that extra 00 in the format column.

 

In normal SAS code it might look like:

data want;
  length ccy_ccd $3 ;
  format ccy_ccd $3. ;
....

 

sas-innovate-white.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.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 5 replies
  • 1114 views
  • 2 likes
  • 4 in conversation