Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: : RE: list command


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: : RE: list command
Date   Mon, 4 Aug 2008 18:18:26 +0100

No (I think). (That is, I think I know what I am doing; I just don't
understand what you are saying.) 

If you want an explanation of the code to what now appears to be your
problem, see 

How do I list observations in a group that differ on a variable?
http://www.stata.com/support/faqs/data/diff.html

Your original question was "2 or more". I understand that "more than 1"
is equivalent to "2 or more". That being so, you need not and should not
change my code. 

Nick 
n.j.cox@durham.ac.uk 

Daniel Sepulveda-Adams

The number 1 in this sentence represent that Stata will list all ndc
that
have more than 1 gpi, included 1; therefore if I change the number by 2
will
be what I want. 

bysort ndc (gpi) : list if gpi[1] != gpi[_N]

Nick Cox

It may be that you want to -list- -ndc- for which there are two or more
distinct -gpi-. 

If that is so, -findit distinct-, or 

bysort ndc (gpi) : list if gpi[1] != gpi[_N] 

Daniel Sepulveda-Adams

OK here is an example of what happened in the dataset, this dataset is a
drugs description, therefore codes are associated to names and strength
the
drug and packages size, etc.

Ex:
1) ndc (National Drug Code) assigned one gpi (Generic Product
Identifier)

ndc: 49502007412   gpi: 44100010102005

2) ndc that has more than one gpi (9 in this specific case, why because
each
gpi represent a different packages size)

Ndc: 00904161260  gpi: 44300040007440

Steven Samuels

Daniel, Show us simple examples of data where an observation on  'ndc'
1) does
2) does not

"have two or more gpi".

It seems that by the phrase "two or more gpi" you do NOT mean "gpi = 2"

On Aug 4, 2008, at 11:22 AM, Daniel Sepulveda-Adams wrote:

> I have a question about list command; this is what I'm doing:
>
> list ndc old_ndc e49_ gpi g64_ if gpi>"2"
>
> gpi is a str variable (it is a 14 digit code) & I know is wrong but  
> I can
> not figure it out how I can ask the program give me all ndc that  
> has 2 or
> more gpi.Thanks

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index