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 ;-
You have a couple of problems with your code. I presume you used a libname statement to specify the Preeti library, but you never used the fmtsearch option to tell SAS that is where your formats exist.
Plus, you included that libname in one of your assignment statements, which you should not have done. i.e., you used:
format preeti.hlthfood hlthfood.;
when you should have used:
format hlthfood hlthfood.;
You also specified some formats that you never created, like custid.
I didn't correct all of those errors, but the following should be enough for you to correct (i.e., delete the unassigned format declarations):
libname Preeti '/folders/myfolders'; 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_coupons; input hlthfood size org custid gender shopfor veg style usecoup week seq carry coupval amtspent; cards; 0 1 2 3 1 1 1 1 1 1 1 1 1 1 1 2 3 2 0 1 1 1 1 1 1 1 1 1 ; options fmtsearch=(preeti); data preeti.grocery_coupons1; set Preeti.grocery_coupons; format preeti.hlthfood hlthfood.; format 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;
Art, CEO, AnalystFinder.com
You have a couple of problems with your code. I presume you used a libname statement to specify the Preeti library, but you never used the fmtsearch option to tell SAS that is where your formats exist.
Plus, you included that libname in one of your assignment statements, which you should not have done. i.e., you used:
format preeti.hlthfood hlthfood.;
when you should have used:
format hlthfood hlthfood.;
You also specified some formats that you never created, like custid.
I didn't correct all of those errors, but the following should be enough for you to correct (i.e., delete the unassigned format declarations):
libname Preeti '/folders/myfolders'; 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_coupons; input hlthfood size org custid gender shopfor veg style usecoup week seq carry coupval amtspent; cards; 0 1 2 3 1 1 1 1 1 1 1 1 1 1 1 2 3 2 0 1 1 1 1 1 1 1 1 1 ; options fmtsearch=(preeti); data preeti.grocery_coupons1; set Preeti.grocery_coupons; format preeti.hlthfood hlthfood.; format 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;
Art, CEO, AnalystFinder.com
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.
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.