BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
amin1234
Obsidian | Level 7

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;

 

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

Ok so add a $ to format name and try again

proc format;

value $disf 0='No' 1='Yes';

run;

 

View solution in original post

6 REPLIES 6
novinosrin
Tourmaline | Level 20

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;

PaigeMiller
Diamond | Level 26

Is the variable DISEASED numeric or character?

--
Paige Miller
amin1234
Obsidian | Level 7

It's a character variable. 

novinosrin
Tourmaline | Level 20

Ok so add a $ to format name and try again

proc format;

value $disf 0='No' 1='Yes';

run;

 

ballardw
Super User

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 7908 views
  • 0 likes
  • 4 in conversation