BookmarkSubscribeRSS Feed
jonty
Fluorite | Level 6

please help me with this....

i want to put value in variable but its showing error....

reply fast please......

 

code;-

 


proc format lib=Preeti;
value hlthfood
0='No'
1='Yes';
value size
1='Small'
2='Medium'
3='Large';
value org
1='Emphasizes produce'
2='Emphasizes deli'
3='Emphasizes bakery'
4='No emphasis';
value gender
0='Male'
1='Female';
value shopfor
1='Self'
2='Self and spouse'
3='Self and family';
value veg
0='No'
1='Yes';
value style
1='Biweekly' and 'in bulk'
2='Weekly' and 'similar items'
3='Often' and 'whats on sale';
value usecoup
1='No'
2='From newspaper'
3='From mailings'
4='From both';

value carry
0='First period'
1='No coupon'
2='5 percent'
3='15 percent'
4='25 percent';

Value coupval
1='No value'
2='5 percent'
3='15 percent'
4='25 percent'
run;

data preeti.grocery_coupons1;
set Preeti.grocery_coupons;
format preeti.hlthfood hlthfood.;
format size size. ;
format org org. ;
format custid custid. ;
format gender gender. ;
format shopfor shopfor. ;
format veg veg. ;
format style style. ;
format usecoup usecoup. ;
format week week. ;
format seq seq. ;
format carry carry. ;
format coupval coupval. ;
format amtspent amtspent. ;
run;

 

error ;-

 

data preeti.grocery_coupons1;
 
111 set Preeti.grocery_coupons;
112 format preeti.hlthfood hlthfood.;
_________
484
ERROR: Invalid variable specification, preeti.hlthfood. Variable names of the form X.X must be either FIRST.X or LAST.X.
ERROR: The name preeti.hlthfood is not a valid SAS name.
NOTE 484-185: Format HLTHFOOD was not found or could not be loaded.
 
113 format size size. ;
_____
484
NOTE 484-185: Format SIZE was not found or could not be loaded.
 
114 formatorgorg. ;
____
484
NOTE 484-185: Format ORG was not found or could not be loaded.
 
115 formatcustidcustid. ;
_______
484
NOTE 484-185: Format CUSTID was not found or could not be loaded.
 
116 formatgendergender. ;
_______
484
NOTE 484-185: Format GENDER was not found or could not be loaded.
 
117 formatshopforshopfor. ;
________
484
NOTE 484-185: Format SHOPFOR was not found or could not be loaded.
 
118 formatvegveg. ;
____
484
NOTE 484-185: Format VEG was not found or could not be loaded.
 
119 formatstylestyle. ;
______
484
NOTE 484-185: Format STYLE was not found or could not be loaded.
 
120 formatusecoupusecoup. ;
________
484
NOTE 484-185: Format USECOUP was not found or could not be loaded.
 
121 formatweekweek. ;
_____
484
NOTE 484-185: Format WEEK was not found or could not be loaded.
 
122 formatseqseq. ;
____
484
NOTE 484-185: Format SEQ was not found or could not be loaded.
 
123 formatcarrycarry. ;
______
484
NOTE 484-185: Format CARRY was not found or could not be loaded.
 
124 formatcoupvalcoupval. ;
________
484
NOTE 484-185: Format COUPVAL was not found or could not be loaded.
 
125 formatamtspentamtspent. ;
_________
484
NOTE 484-185: Format AMTSPENT was not found or could not be loaded.
 
126 run;
2 REPLIES 2
Astounding
PROC Star

You are encountering two types of problems.

 

The first problem occurs just once, on the first FORMAT statement.  It should read:

 

format hlthfood hlthfood.;

 

The syntax of table_name.field_name is generally not used within SAS ... perhaps only within PROC SQL.  The remaining FORMAT statements appear to be correct.  Which leads to the second problem. 

 

You have stored these formats permanently.  However, you have not told SAS where to look, to retrieve the formats.  That actually requires an additional statement, such as:

 

options fmtsearch=(Preeti, work);

 

It seems strange that you can create formats early in the program, save them, and yet SAS cannot find them.  But that's what happens when you permanently save formats.  You have to add the FMTSEARCH option to tell SAS where to look.

jonty
Fluorite | Level 6

thank you so much

i like your support....

 

and its strange that i havent used FMTSEARCH and dont know how it still worked 

well i am a rookiee to sas so i believe these probs are common for me as i am not from any science studies.

 

still respect for you, you helped me i loved it

 

regards

jonty

sas-innovate-2024.png

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.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 2157 views
  • 0 likes
  • 2 in conversation