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;
You don't need a format for character variables. SAS will always display all characters.
So the value would contain dollar amounts?
Any reason it isn't numeric?
It looks like a currency code..rather than a number
If it contains values like "USD" or "EUR", then positively no format is needed.
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. ;
....
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.
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.
Ready to level-up your skills? Choose your own adventure.