stats unique
Moderators: EViews Gareth, EViews Moderator
-
- Non-normality and collinearity are NOT problems!
- Posts: 3775
- Joined: Wed Sep 17, 2008 2:25 pm
stats unique
It would be nice if stats and statsby had an option to count the number of unique values. For example, I have teacher ids and I'd like to know how many teachers were in each grade.
-
- EViews Developer
- Posts: 2671
- Joined: Wed Oct 15, 2008 9:17 am
Re: stats unique
How about
Code: Select all
series uniqueids = @sumsby(1, grade)
-
- Non-normality and collinearity are NOT problems!
- Posts: 3775
- Joined: Wed Sep 17, 2008 2:25 pm
Re: stats unique
EViews Glenn wrote:How aboutCode: Select all
series uniqueids = @sumsby(1, grade)
I think that gives me the number of observations in each grade. I want to know how many teachers are in each grade, where observations are on students and a number of students have the same teacher.
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13294
- Joined: Tue Sep 16, 2008 5:38 pm
Re: stats unique
That doesn't do what he wants, I think.
You need the cross of unique vals.
You need the cross of unique vals.
Follow us on Twitter @IHSEViews
-
- EViews Developer
- Posts: 2671
- Joined: Wed Oct 15, 2008 9:17 am
Re: stats unique
Yeah. Just saw that when I reread it; was about to edit my post but you beat me to it. I was trying to think of how to do it with @uniquevals but then got distracted and when I came back it seemed so obvious
[edit] You should be able to get it with n-way tabulation but that requires some manual computation and doesn't link back to the obs in the workfile.
[edit] You should be able to get it with n-way tabulation but that requires some manual computation and doesn't link back to the obs in the workfile.
-
- Non-normality and collinearity are NOT problems!
- Posts: 3775
- Joined: Wed Sep 17, 2008 2:25 pm
Re: stats unique
In the application at hand, I have about 13,000 observations and 1,000 teachers. So I'd rather not produce a list of unique teacher ids. What I did was
and then repeated the code for different smpl if conditions. But an addition to stats would be nice.
Code: Select all
smpl if grade="G0"
scalar teachCount = @rows(@uniquevals(tchid))
and then repeated the code for different smpl if conditions. But an addition to stats would be nice.
-
- EViews Developer
- Posts: 2671
- Joined: Wed Oct 15, 2008 9:17 am
Re: stats unique
Fair enough. Just wanted to make sure you could get your work done for now. A @ranksby and related functions would similarly be useful.
Return to “Suggestions and Requests”
Who is online
Users browsing this forum: No registered users and 10 guests