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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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