DATA Step, Macro, Functions and more

how to output partition?

Reply
Occasional Contributor
Posts: 19

how to output partition?

Hello,

I have following code running in SAS,

 

proc adaptivereg data=imported_excel
SEED = 123
PLOTS = ALL
details=bases;
partition fraction(validate=0.25 test=0.25);
model Y = A B C;
RUN;

 

is there anyway I can output the partition dataset, test,validate, respectively? Thanks.

Super User
Posts: 17,829

Re: how to output partition?

Ok...I tried to run it to check, but it keeps crashing in SAS Studio.

 

If you generate an OUTPUT data set, does it contain a _ROLE_ variable that denotes what each observation was categorized?

You can generate the OUTPUT data set using something like

 


   output out=dataset_role;

 

If you have partitioned the input data by using a PARTITION statement, then a character variable _ROLE_ is included in the output data set. For each observation the value of _ROLE_ is as follows:
_ROLE_ Observation
TEST Testing
TRAIN Training 
VALIDATE Validation
Occasional Contributor
Posts: 19

Re: how to output partition?

Reeza, 

 

Thanks for your reply. 

 

I did your suggestion, but no data set was generated. Where should I insert "output out=dataset_role" to my model? Thanks. 

 

Super User
Posts: 17,829

Re: how to output partition?

proc adaptivereg data=imported_excel 
SEED = 123 
PLOTS = ALL
details=bases;
partition fraction(validate=0.25 test=0.25);
model Y = A B C;
output out=dataset_role;
RUN;

If this doesn't work post your log. I ran it using the example in the documentation and it worked fine.

 

 https://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_adaptivereg...

Occasional Contributor
Posts: 19

Re: how to output partition?

Reeza,

 

Thanks for your reply. It does work, but I still got one question. So I am using 25% of the whole dataset as "test", the number of observations in my whole data set is 816, literally I should get 204 "test" observations. However, I found there were 211 observations pulled out as "test" with the code above, is there anything wrong with this? Not a big deal, just curious, thanks! 

Super User
Posts: 17,829

Re: how to output partition?

No idea, I would consider passing that on to Tech Support. 

Ask a Question
Discussion stats
  • 5 replies
  • 234 views
  • 0 likes
  • 2 in conversation