What is wrong with this approach?
Code: Select all
for !i=1 to @obsrange
if uniquegroups(!i) = "" then
delete uniquegroups(!i)
endif
nextModerators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
Code: Select all
for !i=1 to @obsrange
if uniquegroups(!i) = "" then
delete uniquegroups(!i)
endif
nextCode: Select all
svector uniques = @uniquevals(@convert(alpha, "if alpha <> """""))
That makes a lot of sense. I just added the '@convert' part to my existing alpha series 'uniquegroups'. Thanks Matt!Hello,
The delete command removes entire objects, not individual observations. In addition, the length of an alpha series is dependent on the workfile page's observations, so you cannot "shorten" the alpha series without removing observations from the workfile page. If that's what you want, to affect the entire page, then take a look at the pagecontract command.
Considering your recent previous thread on a similar topic, I'm guessing you still just want some kind of list of all the unique elements (excluding blanks) in an alpha series. Here's another solution that may be of greater use to you:
where "alpha" is the name of the alpha series. The call to @convert generates an svector containing the non-blank elements of the alpha series, which is then filtered by @uniquevals to extract only the unique elements. Note that an svector is used to hold the subset of elements from the alpha series because the length of an svector is independent of the workfile page's observations. And FYI, I've used the conditional sample shown above instead of the more intuitive "if alpha <> """ to avoid an issue with nested quotes in strings.Code: Select all
svector uniques = @uniquevals(@convert(alpha, "if @length(alpha) > 0"))
Code: Select all
%originalPage = @pagename
pagecopy(page=tmp) alpha
sort alpha
copy alpha {%originalPage}\alpha
pagedelete tmp
Hmmm, okay. That might be a little more trouble than its worth. Thank you for your help!I'm not aware of any way to sort a series without affecting the rest of its page. I believe you'll need to copy the data to a new page, sort it there, and then copy it back. For example:
Code: Select all
%originalPage = @pagename pagecopy(page=tmp) alpha sort alpha copy alpha {%originalPage}\alpha pagedelete tmp
Users browsing this forum: No registered users and 2 guests