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

the first time used before proc glm works.

the second time has no effect at all.

why?

 


ODS PDF FILE="/caslibs/risknb/_covid on RV.pdf"
nogtitle nogfootnote STYLE=SASWEB DPI=300;

ods exclude where=^(_name_ in ("ParameterEstimates" "NObs" "Estimates" ));

title "Covid effect on RV by year";
proc glm data=&ds.5 plots=all noprint;
where (^outlier)*(fuel_type not in ('Hybrid Diesel' '')) *(_gama_fuel in (&mods)) *(CONTROL_YEAR NE '');
/* *(_gama_fuel in ('A1*Diesel' 'A1*Petrol')); */
/* format RMDFECHAVENTA yyq6.; */
class _gama_fuel  CONTROL_YEAR fuel_type _brand;
model sales_res = _gama_fuel  CONTROL_YEAR actual_mileage  _brand*meses_efectivos
_brand*meses_efectivos*meses_efectivos _brand*fuel_type*actual_mileage / solution e ;
LSMEANS CONTROL_YEAR / E AT (MESES_EFECTIVOS ACTUAL_MILEAGE) = (12 30000) obsmargins out=risknoba._12lsmeans  ;
LSMEANS CONTROL_YEAR / E AT (MESES_EFECTIVOS ACTUAL_MILEAGE) = (24 60000) obsmargins out=risknoba._24lsmeans  ;
LSMEANS CONTROL_YEAR / E AT (MESES_EFECTIVOS ACTUAL_MILEAGE) = (36 90000) obsmargins out=risknoba._36lsmeans  ;
LSMEANS CONTROL_YEAR / E AT (MESES_EFECTIVOS ACTUAL_MILEAGE) = (48 120000) obsmargins out=risknoba._48lsmeans  ;
LSMEANS CONTROL_YEAR / E AT (MESES_EFECTIVOS ACTUAL_MILEAGE) = (60 150000) obsmargins out=risknoba._60lsmeans  ;
estimate 'global difference same for all terms'
              control_year -1 1;
store work.covid_glm;
run;

ods exclude none;

data risknoba.all_covid;
set RISKNOBA._12LSMEANS RISKNOBA._24LSMEANS RISKNOBA._36LSMEANS RISKNOBA._48LSMEANS RISKNOBA._60LSMEANS indsname=sourcy;
report_orig=SCAN(sourcy,2,'.');
format RMDFECHAVENTA yyq6.;
months=input(substr(report_orig,2,2),3.);
kms=months*30000/12;
qtr_year=put(RMDFECHAVENTA, yyq6.);
run;


proc cas ;
  table.save /
    table={name="ALL_COVID", caslib="risknoba"} compress=false replace=true
    name="Covid effect on RV by year.xlsx" caslib="risknoba"
    exportOptions={                                               
        fileType="auto"
    };
run;


ods exclude where=^(_name_ in ("ParameterEstimates" "NObs" "Estimates" ));

title "Covid effect on RV by year and by brand";
proc glm data=&ds.5 plots=all noprint;
where (^outlier)*(fuel_type not in ('Hybrid Diesel' '')) *(_gama_fuel in (&mods)) *(CONTROL_YEAR NE '');
/* *(_gama_fuel in ('A1*Diesel' 'A1*Petrol')); */
by _brand;
/* format RMDFECHAVENTA yyq6.; */
class _gama_fuel  CONTROL_YEAR fuel_type _brand;
model sales_res = _gama_fuel  CONTROL_YEAR actual_mileage  _brand*meses_efectivos
_brand*meses_efectivos*meses_efectivos _brand*fuel_type*actual_mileage / solution e ;
LSMEANS CONTROL_YEAR / E AT (MESES_EFECTIVOS ACTUAL_MILEAGE) = (12 30000) obsmargins out=risknoba._12lsmeans  ;
LSMEANS CONTROL_YEAR / E AT (MESES_EFECTIVOS ACTUAL_MILEAGE) = (24 60000) obsmargins out=risknoba._24lsmeans  ;
LSMEANS CONTROL_YEAR / E AT (MESES_EFECTIVOS ACTUAL_MILEAGE) = (36 90000) obsmargins out=risknoba._36lsmeans  ;
LSMEANS CONTROL_YEAR / E AT (MESES_EFECTIVOS ACTUAL_MILEAGE) = (48 120000) obsmargins out=risknoba._48lsmeans  ;
LSMEANS CONTROL_YEAR / E AT (MESES_EFECTIVOS ACTUAL_MILEAGE) = (60 150000) obsmargins out=risknoba._60lsmeans  ;
estimate 'brand specific difference same for all terms'
              control_year -1 1;
store work.covid_glm;
run;

ods exclude none;
...
1 ACCEPTED SOLUTION

Accepted Solutions
1 REPLY 1
ChrisNZ
Tourmaline | Level 20

A question for tech support I reckon.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 1 reply
  • 771 views
  • 0 likes
  • 2 in conversation