Exclude NAs and Set Multiple Conditions

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

Greentea
Posts: 19
Joined: Tue Jan 27, 2009 3:50 pm

Exclude NAs and Set Multiple Conditions

Postby Greentea » Thu Feb 12, 2009 11:04 am

I’m not sure where to add a condition. I have a balanced sample of annual data from 1988 to 2005 for 848 cross-sections. Each cross-section has 9 accounting variables for each year. However, the values of these accounting variables in many years are NA. I need to skip all these NAs and to perform the Principal Components Analysis (PCA) across remaining years for each of the 848 cross sections. So:

group pcd9e dBOOK dCAC dCALOW dCALTA dCATLIA dCREDM dCREDT dDY dFIXA
for !firm=1 to 848
smpl if dBOOK not = NA and dCAC not = NA and dCALOW not = NA and dCALTA not = NA and dCATLIA not = NA and dCREDM not = NA and dCREDT not = NA and dDY not = NA and dFIXA not = NA pc9e.pcomp(cor, eigval=v1, eigvec=m1) pc1 pc2 pc3 pc4 pc5
v1.write v_1{!firm}.xls
m1.write m_1{!firm}.xls
group comps pc1 pc2 pc3 pc4 pc5
write comps_{!firm}.xls comps
next

Alternatively, the condition can be write as:
If dBOOK = NA and dCAC = NA and dCALOW = NA and dCALTA = NA and dCATLIA = NA and dCREDM = NA and dCREDT = NA and dDY = NA and dFIXA = NA and crossed = !firm

Then I don’t know how to exclude above and run a PCA.

Thank you so much!

Greentea
Posts: 19
Joined: Tue Jan 27, 2009 3:50 pm

Re: Exclude NAs and Set Multiple Conditions

Postby Greentea » Wed Feb 18, 2009 12:00 pm

Could anyone help me out, please? Or, have I made myself clear yet?


Return to “Programming”

Who is online

Users browsing this forum: Google [Bot] and 68 guests