Take your code:
data Apple_price(drop=Age);
length key $25 Apple_price_c $10 Factor_c $10;
set in.Apple_price;
key = compress('Case'||ID||'_'||Group||'_'||put(Unit,z2.),,'kadp');
Apple_price_c = 'Apple_price';
Factor_c = 'Factor';
run;
Use the CHANGE command to convert APPLE to &COV. If you are using the SAS editor just type this on the command line:
change 'Apple' '&cov.' i all
data &cov._price(drop=Age);
length key $25 &cov._price_c $10 Factor_c $10;
set in.&cov._price;
key = compress('Case'||ID||'_'||Group||'_'||put(Unit,z2.),,'kadp');
&cov._price_c = '&cov._price';
Factor_c = 'Factor';
run;
Then make sure that your macro variable reference is not inside of string quoted used single quotes instead of double quotes.
data &cov._price(drop=Age);
length key $25 &cov._price_c $10 Factor_c $10;
set in.&cov._price;
key = compress('Case'||ID||'_'||Group||'_'||put(Unit,z2.),,'kadp');
&cov._price_c = "&cov._price";
Factor_c = 'Factor';
run;
... View more