Hi all,
I want to use the code as below to avoid truncation.
proc format library=work; value $cmfreq "1" = "BID" "2" = "TID" "3" = "QID" other=[$100.] ; run;
But how to use cntlin to replace this code.
data tmp_format; set tmp_format; by fmtname; output; if last.fmtname then do; start='other'; end='other'; label='[$200.]'; output; end; run;
The code as below is not work.
Thanks.
Hi @Lee_wan,
I would mostly
In your example the result could be:
data fmt;
retain fmtname 'cmfreq' type 'C';
infile cards eof=eof;
input start $ label $;
output;
return;
eof:
hlo='OF';
label='$100.';
output;
cards;
1 BID
2 TID
3 QID
;
proc format cntlin=fmt;
run;
"The code as below is not work" tells us exactly nothing. Describe the problem, show the log.
I suspect you should start by looking at the HLO dataset variable, or maybe at the DEFAULT= option for the VALUE statement.
Hi @Lee_wan,
I would mostly
In your example the result could be:
data fmt;
retain fmtname 'cmfreq' type 'C';
infile cards eof=eof;
input start $ label $;
output;
return;
eof:
hlo='OF';
label='$100.';
output;
cards;
1 BID
2 TID
3 QID
;
proc format cntlin=fmt;
run;
Doesn't work is awful vague.
Are there errors in the log?: Post the code and log in a code box opened with the <> to maintain formatting of error messages.
No output? Post any log in a code box.
Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the <> icon or attached as text to show exactly what you have and that we can test code against.
Bad coding form for people without a lot of SAS experience to use
data tmp_format; set tmp_format; by fmtname;
as that completely overwrites your starting data set an if there is a logic error you will have to go back an recreate the original tmp_format.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.