I need to restructure my data. I think I should be using the pagestruct command (I want to do this in a program), but don't quite see how.
I have an unstructured data file with about 11,000 observations. Each observation has a variable STDNTID which identifies a unique student number. I also have variables of the form gkclasstype, g1classtype, g2classtype, g3classtype which define the type of class in grades K-3.
I want a panel with the student number as one dimension and the grade as the other. Then I want a new variable CLASSTYPE which "stacks" the four variables g?classtype. (Of course, I have more variables than just this one to be stacked.)
I suspect that this is one or two lines of code, but I'm not seeing it.
Pagestruct?
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Pagestruct?
Not 100% certain I follow, but something like this:
Code: Select all
create u 11000
series STDNTID = @trend+1000
series gkclasstype=nrnd
series g1classtype=nrnd
series g2classtype=nrnd
series g3classtype=nrnd
pagestack gk g1 g2 g3 @ ?*
rename id01 stdntid
rename var01 class
pagestruct class stdntid
-
startz
- Non-normality and collinearity are NOT problems!
- Posts: 3797
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Pagestruct?
Thanks Gareth. This gets me most of what I need.
I also have variables in the original page that are constant with regard to class, such as student id, birthmonth, etc. Presumably I need to copy them to the new page matching on student id and expanding across class. There are two pieces I don't see how to do.
(1) After the pagestruck, how do I use the copy command to get the merge done right?
(2) How do I do whatever the answer is to (1), when the student id isn't yet in the new page?
edit after a little more investigation...
I see I can go
but is there a way to copy multiple series or do I need a copy command for each individual series?
I've managed to manually construct student id in the new page, but is there a "right" way to do it?
I also have variables in the original page that are constant with regard to class, such as student id, birthmonth, etc. Presumably I need to copy them to the new page matching on student id and expanding across class. There are two pieces I don't see how to do.
(1) After the pagestruck, how do I use the copy command to get the merge done right?
(2) How do I do whatever the answer is to (1), when the student id isn't yet in the new page?
edit after a little more investigation...
I see I can go
Code: Select all
copy oldpage\birthmonth newpage\birthmonth stdntid stdntid
I've managed to manually construct student id in the new page, but is there a "right" way to do it?
-
startz
- Non-normality and collinearity are NOT problems!
- Posts: 3797
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Pagestruct?
The commands
give the basic right structure, except that the panel is ordered G1 G2 G3 GK rather than GK G1 G2 G3. It's important that kindergarten comes first! Is there a way around this, other than something like recoding "GK' to be "G0"?
Code: Select all
pagestack(page=reorgSTAR,interleave) gk g1 g2 g3 @ ?*
series stdntid = id01 + 9999
rename var01 class
pagestruct stdntid classWho is online
Users browsing this forum: No registered users and 2 guests
