• Home
  • About Dominick A. Leone
    • Homepage
  • SAS Code
  • Pubfacts | Pubmed listing
  • ResearcherID
  • ORCID
  • SciENcv
  • NCBI Bibliography

Dominick A. Leone

Dominick A. Leone

Category Archives: SAS

How to generate p-values for a covariate with linear and quadratic term in PROC Logistic

21 Sunday Aug 2016

Posted by Dominick A. Leone in SAS

≈ Leave a comment

Step 1: Capture variables from Proc Logistic

PROC Logistic data= <dataset> ;

Class
<Var-1>  <var-2>  <categorical_var-n>; ** can go here with “/“ e.g. param=glm ;

Model
<Outcome_Var> = <Main-predictor> <Factor-1> <Factor-n> <Non-linear_Covariate> | <Non-linear_Covariate> ;

Oddsratio <Non-linear_Covariate> / at (MSPSS_scale= 20 30 40 50 60 70 80 90 ); ;

ODS Output OddsRatios = OR_Dataset ;
ODS Output OddsRatiosWald = OR_Wald_Dataset ;

RUN;

Step 2: Generate variables for p-values for linear factors

DATA orwp_linear;

Set OR_Dataset;

alpha=.05 ;
stderr=abs(log(uppercl)-log(lowercl)) / (2*probit(1-alpha/2)) ;
wald=(log(oddsratioest)/stderr)**2 ;
p=1-probchi(wald,

Drop alpha ;

RUN;

Step 3: Generate variables for p-values for non-linear factors

 

DATA orwp_nonlinear;

Set OR_Wald_Dataset;

alpha=.05 ;
stderr=abs(log(uppercl)-log(lowercl)) / (2*probit(1-alpha/2)) ;
wald=(log(oddsratioest)/stderr)**2 ;
p=1-probchi(wald,

Drop alpha ;

RUN;

Step 4: Print table of linear and non-linear factors

 

PROC Print data= orwp_linear label noobs;

Format p pvalue6. ;
Label stderr=”Standard Error” wald=”Wald Chi-Square” p=”Pr > ChiSq”;

RUN;

PROC Print data= orwp_nonlinear label noobs;

Format p pvalue6. ;
Label stderr=”Standard Error” wald=”Wald Chi-Square” p=”Pr > ChiSq”;

RUN;

 

Advertisement

The Tabulate Procedure

02 Saturday Jul 2016

Posted by Dominick A. Leone in SAS

≈ Leave a comment

For Continuous Variables

PROC Tabulate data= <library.dataset> ;

CLASS <Column-var_1> … <Column-var_n> ;

VAR <factor_1> … <factor_n>  ;

TABLE ( <factor_1> … <factor_n> ) , (All <Column-var_1>  … <Column-var_n> )              *( N Mean Std) ;

TABLE ( <factor_1> … <factor_m> ) , (All <Column-var_1>  … <Column-var_n> )              *( N Median Qrange) ;

RUN;

For Count/Categorical Variables

PROC Tabulate data= <library.dataset> ;

CLASS  <column-var_1>  … <column-var_n>  <factor_1> … <factor_n> ;

TABLE ( <factor_1> … <factor_n> ) , (All <column-var_1>  … <column-var_n> )                 *(  Colpctn N ) ;

RUN;

Software

  • R Website Beginning page where you can find everything related to R: downloads, extensions, information, and general help

Software

  • R Website

ResearcherID

Blog at WordPress.com.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Follow Following
    • Dominick A. Leone
    • Already have a WordPress.com account? Log in now.
    • Dominick A. Leone
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar