DATA Step, Macro, Functions and more

proc format with cntlin

Reply
New Contributor
Posts: 4

proc format with cntlin

Is it possible to create a format mapping multiple inputs to one label 

e.g. value odds 1,3,5 = 'ODD'

 

using an input dataset and CNTLIN ?

Super User
Posts: 5,513

Re: proc format with cntlin

Posted in reply to NedKaufman

Yes, but you need a separate observation for each value being mapped ... along the lines of:

 

label='ODD';

do start=1, 3, 5; output; end;

 

New Contributor
Posts: 4

Re: proc format with cntlin

Posted in reply to Astounding
Thank you!
Super User
Posts: 7,809

Re: proc format with cntlin

Posted in reply to NedKaufman
data cntlin;
type = 'N';
fmtname = 'myfmt';
length label $8;
label = 'Odd';
do i = 1 to 5 by 2;
  start = put(i,8.);
  output;
end;
start = 'other';
label = 'Even';
output;
run;

Try this.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 3 replies
  • 94 views
  • 0 likes
  • 3 in conversation