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
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.