Dear All
My data is as follows
ID IDA
CO CO
I I
HUF HUF
.
.
B B
I want to fill in the two missing values in IDA
ID IDA
CO CO
I I
HUF HUF
. NO_CAT
. NO_CAT
B B
I wrote these lines
Data want; set have;
if IDA = '.' then do ; IDA = NO_CAT: end ;
run;
What mistake am I making
Randy
NO_CAT must be a string. In addition to that, missing for character values are indicated with '' rather than '.'
if IDA = '' then IDA = 'NO_CAT';
-unison
Maybe this? Not sure if there is a real dot in IDA or not. If not then remove it.
Data want; set have;
if IDA = '.' then do ;
IDA = 'NO_CAT';
end ;
run;
Hi @RandyStan ,
i followed as per @SASKiwi it is working fine.
If it is character variable then we should not use . just simply ' ';please have a look on below code and it is working as expected.
Data have;
input IDA $3. IDA1 $6.;
datalines;
ID IDA
CO CO
I I
HUF HUF
.
.
B B
;
run;
Data want;
set have;
if IDA = ' ' then do IDA1 = 'NO_CAT';
end;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.