I created and user defined format but when I run data step to apply format the log reads Format $disf was not found or could not be loaded. I am using SAS University Edition. Engine V9. Below is the full code. Any ideas will be appreciated.
libname abc "/folders/myfolders/xyz";
Proc import datafile="/folders/myfolders/xyz/document.xlsx"
out=doc1
dbms=xlsx;
run;
proc format;
value disf 0='No' 1='Yes';
run;
data doc2; set doc1;
format diseased disf.;
run;
Ok so add a $ to format name and try again
proc format;
value $disf 0='No' 1='Yes';
run;
You need to examine your dataset doc1 thoroughly and properly. Your code works fine for my example:
proc format;
value disf 0='No' 1='Yes';
run;
data w;
do i=1 to 10;
do j=0 to 1;
output;
end;
end;
format j disf.;
drop i;
run;
Is the variable DISEASED numeric or character?
It's a character variable.
Ok so add a $ to format name and try again
proc format;
value $disf 0='No' 1='Yes';
run;
@novinosrin wrote:
Ok so add a $ to format name and try again
proc format; value $disf 0='No' 1='Yes'; run;
AND use the new format:
data doc2; set doc1;
format diseased $disf.;
run;
Thank you! @ballardw @novinosrin @PaigeMiller
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.