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

From |
Suzy <[email protected]> |

To |
[email protected] |

Subject |
Re: st: Re: destringing |

Date |
Sat, 28 Aug 2004 11:30:29 -0400 |

Thanks so much for everyone's help. I am enclosing the code and output I used that drove me to my problems.:

First, here is my reduced infile and Stata's output:

. infix var11-2 var2 3 var3 4 var4 5-6 var5.... 7 dxcode1 28-32 dxcode2 33-37 dxcode3 38-42 dxcode4 43-47 dxcode5 48-52 dxcode6 53-57 dxcode7 58-62 procode1 63-66 procode2 67-70 procode3 71-74 procode4 using "C:\Stata8\Data\Dataset.TXT"

Here was Stata's output:

5990-' cannot be read as a number for dxcode6[1134]

'2874-' cannot be read as a number for dxcode7[1134]

2765-' cannot be read as a number for dxcode3[1156]

'E9331' cannot be read as a number for dxcode4[1156]

'V1005' cannot be read as a number for dxcode5[1156]

I contacted Stata and they told me to modify the dxcode1-dxcode 7 and add str5dxcode...which I did.

Here was the infile code for the modification: I also had to do the same for procode1-4 as these variables also had some aplha-numeric datapoints.

. infix var11-2 var2 3 var3 4 var4 5-6 var5.... 7.... str5 dxcode1 28-32 str5 dxcode2 33-37 str5 dxcode3 38-42 str5 dxcode4 43-47 str5 dxcode5 48-52 str5 dxcode6 53-57 str5 dxcode7 58-62 str4 procode1 63-66 str4 procode2 67-70 str4 procode3 71-74 procode4 using "C:\Stata8\Data\Dataset.TXT"

With this command - my dataset came in with no problem.

But then , trying to analyze anything with the dxcode or procode variable name returned this type of output:

. tab dxcode1 if dxcode1==V3000

V3000 not found

r(111);

I also tried this:

tab dxcode1 if dxcode1==v3000

v3000 not found

r(111);

And this....

tab dxcode1 if dxcode1==27500 (just numeric)

type mismatch

r(109);

That's why I then went ahead and used the destring (and force) option...which made the dash and alpha-numerics disappear as missing datapoints - but did allow me to read the pure numeric numbers under these variable names.

Stata technicians did not tell me that when I added the str5 and str4 to those variables during infix - that my data would not be able to be read. So this is the full story.

As of now, I have reentered my data with the str5 and str4 and I am back at square one - which is how do I get Stata to read these 11 string variables (dxcodes1-7 and procode1-4)?

I hope this information is more specific. I needed to go back and replay my steps in order to remember what I had done, so I apologize for less detailed information in the previous e-mails.

I am fairly new to Stata and not very computer programming savvy - so simple is most appreciated. I will feel relieved rather than offended!!

Many thanks to those who have responded thus far!

Suzy

If I go to the data viewer there are over 100 consecutive V3000 datapoints starting from obs1...so it is physically present.

To make things very simple, I only need to read a few of these string variables - not all of them. For example, I need to be able to read 4019- Ultimately though, it would be nice to have all the datapoints read, so I don't miss anything by accident.

Christopher F Baum wrote:

On Aug 28, 2004, at 2:33 AM, Suzy wrote:I used the destring option because I wasn't able to analyze the data as is - I would get error messages regarding not being able to analyze string. These values are codes that represent disorders, so you are correct. But since I am a fairly new user of Stata, I just figured that it couldn't read those values because of the dashes or the alpha-numeric since the datapoints that were only numbers were read and analyzed with no problem.

encode is the answer to this problem. You cannot do anova, for instance, on a string variable, but you can once you have encoded it, and it will still display the 'words' (disorder codes) on the levels of the variable--it is just that they are now value labels for the variable rather than values.

Kit

*

* For searches and help try:

* http://www.stata.com/support/faqs/res/findit.html

* http://www.stata.com/support/statalist/faq

* http://www.ats.ucla.edu/stat/stata/

* * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: Re: destringing***From:*"Michael S. Hanson" <[email protected]>

**Re: st: Re: destringing***From:*"Daniel Egan" <[email protected]>

**RE: st: Re: destringing***From:*"Scott Merryman" <[email protected]>

**References**:**st: Re: destringing***From:*Christopher F Baum <[email protected]>

- Prev by Date:
**st: Bootstrapping multiple stage estimations** - Next by Date:
**RE: st: Re: destringing** - Previous by thread:
**st: Re: destringing** - Next by thread:
**RE: st: Re: destringing** - Index(es):

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