Statalist


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

Re: st: : RE: list command


From   Steven Samuels <[email protected]>
To   [email protected]
Subject   Re: st: : RE: list command
Date   Mon, 4 Aug 2008 12:47:48 -0400

I think that Daniel's second example would be:
Ndc: 00904161260  gpi: 44300040007440
     00904161260  gpi: 44300040007441
and that he wants to list instances where the same NDC has 2 or more GPI's.

If so:

bysort ndc (gpi): gen count=_N // counts number of observations with the same ndc
list ndc old_ndc e49_ gpi g64_ if count>1

OR
egen count= count(gpi), by(ndc)

list ndc old_ndc e49_ gpi g64_ if count>1


If the same ndc gpi combination is listed more than once in the data, Daniel should first:

bysort gpi ndc: keep if _n==1



-Steve



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


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

Please let me know if that clarified my question and thank you for your
help.

Daniel A. Sepulveda Adams
Research Scientist - PRIME Institute
College of Pharmacy - University of Minnesota
308 Harvard ST SE, Weaver Densford Hall, 7-159
Minneapolis, MN, 55455, USA
Phone: 612-624-8489
Cell Phone: 651-295-7771
Fax: 612-625-9931
Email: [email protected]

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Steven Samuels
Sent: Monday, August 04, 2008 10:32 AM
To: [email protected]
Subject: Re: st: : RE: list command

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"


-Steven

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


Hi,

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

Regards -- DSA


*
*   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/

*
*   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/

*
*   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/
*
*   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/

*
*   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/
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index