![]() |
|
|
FlashChat | Actuarial Discussion | Preliminary Exams | CAS/SOA Exams | Cyberchat | Around the World | Suggestions |
DW Simpson |
Actuarial Salary Surveys |
Actuarial Meeting Schedule |
Contact DW Simpson |
![]() |
|
Thread Tools | Search this Thread | Display Modes |
#21
|
|||
|
|||
![]() I have a model y=beta0+beta1*x1+beta2*x2+eps, eps~N(0.1)
and I need to do two test2: 1. H0:beta1=0 2. H0:beta2=0 Can someone help me to do this in SAS? Is this correct? PROC REG DATA = dataset; MODEL y = x1 x2; test x1=0 ; test x2=0; run; How can I save p value from each test to a new data set? |
#22
|
||||
|
||||
![]() Quote:
odsoutput ParameterEstimates=new_data_set; PROCREGDATA = dataset; MODEL y = x1 x2; run;quit; The p values will be in the column named Probt in the data set named new_data_set.
__________________
If at first you don't succeed, you have one data point.
Res ipsa loquitur, sed quid in infernos dicet? |
#23
|
||||
|
||||
![]() I want to create a smaller table from a larger table. My larger table has a character variable, let's say it's date. I want to filter with an if statement so that if the value for each entry in the date variable is 01feb2010 or 01april2010, then it will be included in the smaller table. All other entries for the variable date will be deleted and not included.
I know my code starts with Data small_table; set large_table; if datepart(date) eq '01feb2009'd but don't know how to include the other if statement to finish the data statement code. I'd prefer something like an Excel OR Function. I also understand an "in" may be appropriate. Cheers, Gareth Keenan Suggestions? |
#25
|
||||
|
||||
![]() Two other options are
if datepart(date) IN ('01feb2009'd '01Apr2009'd); /* no comma works */ if datepart(date) = '01feb2009'd or datepart(date) = '01APR2009'd;
__________________
If at first you don't succeed, you have one data point.
Res ipsa loquitur, sed quid in infernos dicet? |
#26
|
||||
|
||||
![]() Another option:
if datepart(date) = '01feb2009'd then output; if datepart(date) = '01APR2009'd then output;
__________________
If at first you don't succeed, you have one data point.
Res ipsa loquitur, sed quid in infernos dicet? |
#28
|
|||
|
|||
![]() I just noticed that you're using an IF statement, one thing that you might want to consider for performance is a WHERE statement.
The big plus to a WHERE statement is performance based. As I understand it, SAS will create a record for each dataline that has a true WHERE (if there is no WHERE then every thing is true so every input line is written) and then will delete lines in statements from IF's. (IF A; is logically and calculation-ally equivalent to IF not A then DELETE; ). For big datasets, you'll see a decent time savings. The downside is that where statements are a little bit more finicky, it won't do data type conversion, so if you're trying to work with numbers stored as text then you'll need to use a PUT or INPUT statement (I always forget which does which). Also, the conditions need to be based on fields that are in the original dataset, so if you're creating a new field during the data step, then you'll need to use an IF statement. Last edited by dumples; 01-10-2011 at 02:52 PM.. |
#29
|
||||
|
||||
![]() I created code that I want to loop through so I can pull data from different directories for different months, how do i loop my code through say from 2010 01 to 2010 12 through some code. I can explain more as needed this is vague...
|
#30
|
||||
|
||||
![]() Two ways:
First way is with macro. %macro blah; %do i = 1 %to 12; <then do things, referring to &i for number> %end; %mend; %blah; Second way would be in data step. data _null_;set whatev; call execute('proc copy in=a out=b;select table'||_n_); run;
__________________
If at first you don't succeed, you have one data point.
Res ipsa loquitur, sed quid in infernos dicet? |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|