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;
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.