08-23-2018
JamesBlack
Fluorite | Level 6
Member since
04-27-2018
- 10 Posts
- 5 Likes Given
- 0 Solutions
- 0 Likes Received
-
Latest posts by JamesBlack
Subject Views Posted 3345 08-22-2018 08:35 AM 3372 08-22-2018 05:01 AM 3417 08-21-2018 10:47 AM 3434 08-21-2018 10:23 AM 2236 06-14-2018 07:21 AM 2240 06-14-2018 07:15 AM 2242 06-14-2018 07:10 AM 2265 06-14-2018 06:34 AM 3532 04-27-2018 08:51 AM 3575 04-27-2018 07:46 AM -
Activity Feed for JamesBlack
- Liked Re: Missing interactions in HPGENSELECT for SAS_Rob. 08-22-2018 09:48 AM
- Posted Re: Missing interactions in HPGENSELECT on Statistical Procedures. 08-22-2018 08:35 AM
- Liked Re: Missing interactions in HPGENSELECT for SAS_Rob. 08-22-2018 08:16 AM
- Posted Re: Missing interactions in HPGENSELECT on Statistical Procedures. 08-22-2018 05:01 AM
- Posted Re: Missing interactions in HPGENSELECT on Statistical Procedures. 08-21-2018 10:47 AM
- Posted Missing interactions in HPGENSELECT on Statistical Procedures. 08-21-2018 10:23 AM
- Posted Re: Error when %including more scoring codes on SAS Programming. 06-14-2018 07:21 AM
- Posted Re: Error when %including more scoring codes on SAS Programming. 06-14-2018 07:15 AM
- Posted Re: Error when %including more scoring codes on SAS Programming. 06-14-2018 07:10 AM
- Posted Error when %including more scoring codes on SAS Programming. 06-14-2018 06:34 AM
- Liked Re: Save Function Result as an Macro Variable for ballardw. 04-30-2018 02:42 AM
- Liked Re: Save Function Result as an Macro Variable for SuryaKiran. 04-27-2018 09:30 AM
- Posted Re: Save Function Result as an Macro Variable on SAS Programming. 04-27-2018 08:51 AM
- Posted Save Function Result as an Macro Variable on SAS Programming. 04-27-2018 07:46 AM
-
Posts I Liked
Subject Likes Author Latest Post 2 2 1 1
08-22-2018
08:35 AM
Thank you very much indeed! I would be very greatful if you had any advice on how to set overdispersion in this type of regression. I know, I can set a fixed number via "disperion" but is there something similar to scale=pearson option which is in GENMOD?
... View more
08-22-2018
05:01 AM
You are definitely right in what you are saying. However, there are still couple of things that I (and my colleagues) don't understand. I have prepared some data... DATA data;
INPUT id var1 $ var2 $ target ;
DATALINES;
1 A X 6
2 A X 2
3 A X 4
4 A Y 6
5 A Y 3
6 A Y 3
7 A Z 0
8 A Z 1
9 A Z 2
10 B X 5
11 B X 7
12 B X 8
13 B Y 0
14 B Y 9
15 B Y 3
16 B Z 7
17 B Z 7
18 B Z 2
19 A Y 1
20 B X 3
;
RUN; I am using Poisson regression... proc genmod data=data;
class var1(ref = "A") var2(ref = "X");
model target = var1 var2 var1*var2
/dist=Poisson link=log type1 type3;
run;
proc hpgenselect data=data;
class var1(ref = "A") var2(ref = "X");
model target = var1 var2 var1*var2
/dist=Poisson link=log;
selection method=NONE details=all;
run; So far, so good... both procedures give identical results. Problem appears when I want only the interaction in the model. Like this: proc genmod data=data;
class var1(ref = "A") var2(ref = "X");
model target = var1*var2
/dist=Poisson link=log type1 type3;
run;
proc hpgenselect data=data;
class var1(ref = "A") var2(ref = "X");
model target = var1*var2
/dist=Poisson link=log;
selection method=NONE details=all;
run; This way GENMOD gives exactly what's needed. HPGENSELECT insists on previous coding and gives estimates only for intercept, {B,Y} and {B,Z}. In my opinion, that is incorrect. Of course this way the two model give different results, predicted values etc. As you say, I can get all interaction combinations when excluding ref setting in class statement like this... proc hpgenselect data=data;
class var1 var2;
model target = var1*var2
/dist=Poisson link=log;
selection method=NONE details=all;
run; The problem is that I do need to have reference categories set. Seems like dead end to me... or am I still missing something? Thank you for your reply.
... View more
08-21-2018
10:47 AM
Yeah, my bad... I forgot to mention that I have model with intercept, therefore I left out {B,Z} as reference category. If you say, it's basic statistics and SAS is doing the right thing, can you please teach me a lesson on why GENMOD gives (in my opinion) correctly estimates for 5 parameters and HPGENSELECT only for 2? Are both procedures doing the right thing, you think?
... View more
08-21-2018
10:23 AM
I may be missing something elemental but I can't get rid of the feeling that hpgenselect handles interaction incorrectly. Let's say I have 2 categorical variables. One with 2 levels and the other with 3 levels. Both of them have a reference category set in the CLASS statement. var1 = {A, B} var2 = {X, Y, Z} I want to have their interaction in the model. Therefore, I include var1*var2 in the MODEL statement. Oddly, I only get parameters estimates for combinations: {A,X} and {A,Y} even though there should be 5 parameters estimated... Ideally, there should be estimates for {A,X}, {A,Y}, {A,Z}, {B,X}, {B,Y}. This manual says that hpgenselect "permits any degree of interaction effects that involve classification and continuous variables". Any hint, please? SAS EG 7.15 HF3 (7.100.5.6132) (64-bit) __ I could use GENMOD which works fine, but it does't support stepwise selection of variables...
... View more
06-14-2018
07:21 AM
Thank you, I noticed this. I don't know how to do that without having to edit all included files separatly... The option to be able to use only one scoring code doesn't look good to me, since I need to score quite big dataset with bunch of models...
... View more
06-14-2018
07:15 AM
Mine too, but I don't know how to do that in a simple way in one piece of code. Editing multiple prefabricated SAS codes which suppose to save my time, seems ineffective to me...
... View more
06-14-2018
07:10 AM
To your First, it is proper technique to score data using %include in data step, see "The CODE statement". I'm aware of semicolons, I just forgot them in this sample code... I would be getting different error, if they were not in my script. I have not noticed that SAS would be case sensitive... Calling this file from a macro desn't make any difference since it doesn't change anything inside the file which causes the error.
... View more
06-14-2018
06:34 AM
Hi, I have more models (HPLogistic/HPgenselect) and use CODE FILE to score data. When reading this file using %include into a datastep like this: DATA want;
SET have;
%include '\\sasmat\FirstHPgenSelect.sas'
%include '\\sasmat\SecondHPgenSelect.sas'
%include '\\sasmat\ThirdHPgenSelect.sas'
RUN; following error occurres: +_SKIP_000: _________ 305 ERROR 305-185: Label has already been used. ... It reads only the first %include and gives the error for all the others. It seems like the code wants to navigate to a specific location in the generated scoring code which has the same name in all these files and Sas can't handle it. Any idea how to overcome this problem is highly appriciated. Thanks 😉 ___ *SAS EG version 7.15 HF3 (7.100.5.6132) (64-bit)
... View more
04-27-2018
08:51 AM
Thank you, guys. Your suggestions are useful in combination with my DATA step solution, which is good. I was expecting something simpler, though. When I run: %let want2 = left(put(month(&day_act.) + &i.,best.)); %put &want2.; I get the string 'left(put(month(mdy(3,13,2018)) + -1,best.))'. It's also useful in my code, but this time I would like to have '2' returned. I tried RESOLVE etc. If there were something like that, it would make the code much simpler.
... View more
04-27-2018
07:46 AM
Hi, I need to do following and store result into a macro variable: > extract month from a variable, > add a constant I have: %let day_act = mdy(3,13,2018); %let i = -1; %let want2 = MONTH(&day_act.) + &i.; /*expect to return numeric 2*/ I have been googling for quite some time and tried several combinations of SYSFUNC, EVAL etc. without desired result. ___ BTW. I have come up with following solution: DATA WORK.tmp; want2 = MONTH(&day_act.) + &i.; RUN; DATA _NULL_; SET WORK.tmp; call symput('want2', want2); RUN; %put &want2.; /*It gives exactly what I want*/ BUT! Oddly, when trying to do this: DATA WORK.rep_&want2.; SET WORK.something; RUN; I receive bunch of blank spaces like WORK.rep_ 2, which obviously gives me an error. I would very much appreciate any advice how to reach my goal without DATA step and also I am curious what causes the later error with blank spaces. Thank you.
... View more