tag:blogger.com,1999:blog-1275149608391671670.post3847246855093911996..comments2023-09-28T06:13:40.704-04:00Comments on SAS and R: Example 8.6: Changing the reference category for categorical variablesKen Kleinmanhttp://www.blogger.com/profile/09525118721291529157noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-1275149608391671670.post-3245465380131329692018-02-16T14:18:42.855-05:002018-02-16T14:18:42.855-05:00This is very helpful. I was wondering if it is pos...This is very helpful. I was wondering if it is possible for SAS to make the reference group the average score of the outcome, instead of the order of the variable?<br />Nikkihttps://www.blogger.com/profile/14670891862528575390noreply@blogger.comtag:blogger.com,1999:blog-1275149608391671670.post-45808712449915107152011-08-21T11:22:10.514-04:002011-08-21T11:22:10.514-04:00Just what I was looking for! Thank you!Just what I was looking for! Thank you!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1275149608391671670.post-9728561767060954662011-07-29T10:06:24.082-04:002011-07-29T10:06:24.082-04:00In general, I view almost all use of formats as da...In general, I view almost all use of formats as dangerous and bad practice. The problem with them is that they disguise the actual data, which is what we should be paying attention to. If the formats are not provided, they also limit replicability when sharing data sets. About the only exceptions that come to mind are huge data sets where recoding can add computational burden, and dates, though even there you can get in trouble.<br /><br />For example, a valued colleague just sent me an addendum to a data set, where the new data has to be merged by date. The colleague helpfully noted that the dates in his Excel spreadsheet were "absolute" (with values 1-365) while the dates in my SAS dataset ranged from 01JAN1960. <br /><br />A casual SAS programmer unfamiliar with formats might not realize that the actual stored values of the SAS dates were also "absolute" (actually relative to another date in the data set) and that the apparent dates in 1960 were due to the formatting of the absolute dates relative to the SAS default begin date.<br /><br />In general, while formatting might arguably get you the reference category you want without recoding, I strongly recommend against it.<br /><br />The right solution is for other SAS procs to adopt the more specific syntax used in proc logistic and a few other procs, so that neither recoding nor formats are needed.Ken Kleinmanhttps://www.blogger.com/profile/09525118721291529157noreply@blogger.comtag:blogger.com,1999:blog-1275149608391671670.post-38477583612606538352011-07-14T13:02:49.520-04:002011-07-14T13:02:49.520-04:00In SAS, there's another trick, which prevents ...In SAS, there's another trick, which prevents you from having to sort or recode the data: you can define and apply a format. By default, the CLASS statement orders according to formatted values of the categorical variable.Rick Wicklinhttps://www.blogger.com/profile/13919716786757842151noreply@blogger.comtag:blogger.com,1999:blog-1275149608391671670.post-32135158831540376402011-01-26T00:08:29.055-05:002011-01-26T00:08:29.055-05:00Thanks this was very helpful!Thanks this was very helpful!Anonymousnoreply@blogger.com