Statalist The Stata Listserver


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

Re: st: problems with converting from numerical to string


From   olena-stavrunova@uiowa.edu
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: problems with converting from numerical to string
Date   Sun, 11 Jun 2006 08:38:53 -0500

Thank you, it worked!!!

Quoting Philip Ryan <philip.ryan@adelaide.edu.au>:

> gen str8 F = string(POP, "%8.0f")
> 
> My release 7 manuals are long gone, but I think that release 7 supported 
> the formatting facility as the second, optional, argument of the -string()- 
> function . Certainly, release 8 and 9 do.
> 
> see -help functions-
> 
> Phil
> 
> At 12:28 AM 11/06/2006 -0500, you wrote:
> >Dear Statalist,
> >I am Stata7 user.
> >I have a problem with converting from numerical to string format.
> >My variable POP is in the format  %8.0f. The numbers in POP are whole, the
> >largest entries consist of 8 digits. My problem is that after I do
> >
> >gen str8 F=string(POP),
> >
> >some of the entries of F variable are displayed in scientific notation form
> >like this:
> >
> >     F            POP
> >1.45e+07        14531529
> >
> >This only happens to entries consisting of 8 digits, the appearance of 
> >entries
> >consisiting of less than 8 digits is not altered by conversion.
> >
> >I would appreciate any help on how to deal with this problem.
> >With best regards,
> >Olena Stavrunova
> >
> >
> >----- Forwarded message from olena-stavrunova@uiowa.edu -----
> >     Date: Wed,  7 Jun 2006 07:41:39 -0500
> >     From: olena-stavrunova@uiowa.edu
> >Reply-To: olena-stavrunova@uiowa.edu
> >  Subject: .dct for dataset without end-of-line delimiter: record too long?
> >       To: statalist@hsphsun2.harvard.edu
> >
> >Dear Statalist,
> >I apologize if this is a duplicate - I was not sure whether my first
> message
> >went on correctly.
> >I am Stata7 user.
> >I am trying to infile data from the datafile which does not have
> end-of-line
> >delimiters. My dictionary file looks like this:
> >
> >dictionary using mydata{
> >_lrecl(8231)
> >_column(1)
> >           float caseid %5f "id"
> >...
> >                        }
> >
> >I get the error message:
> >"8231 not allowed
> >dictionary invalid"
> >
> >By trying different # in _lrecl(#) I figured that # must be less than 7999
> in
> >order for my dictionary file to work.
> >But the length of the line in my file is 8231.
> >I would greatly appreciate any advise on how I can infile variables from
> this
> >datafile.
> >With best regards,
> >Olena Stavrunova
> >
> >
> >----- End forwarded message -----
> >
> >
> >
> >
> >*
> >*   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/
> 
> Philip Ryan
> Associate Professor,
> Discipline of Public Health
> 
> Director, Data Management & Analysis Centre
> 
> Associate Dean (IT)
> Faculty of Health Sciences
> 
> postal address:
> Department of Public Health
> Mail Drop 511
> University of Adelaide 5005
> South Australia
> 
> location:
> Level 6
> Bice Building
> Royal Adelaide Hospital
> North Terrace
> Adelaide
> 
> tel 61 8 8303 3570
> fax 61 8 8223 4075
> http://www.public-health.adelaide.edu.au/
> CRICOS Provider Number 00123M
> -----------------------------------------------------------
> This email message is intended only for the addressee(s)
> and contains information that may be confidential and/or
> copyright. If you are not the intended recipient please
> notify the sender by reply email and immediately delete
> this email. Use, disclosure or reproduction of this email
> by anyone other than the intended recipient(s) is strictly
> prohibited. No representation is made that this email or
> any attachments are free of viruses. Virus scanning is
> recommended and is the responsibility of the recipient.
> *
> *   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/



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