Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: creating a text file with a specific format
From
Michael Eisenberg <[email protected]>
To
[email protected]
Subject
Re: st: creating a text file with a specific format
Date
Mon, 6 Feb 2012 09:51:12 -0800
Thanks Nick. It was a general question.
One problem with converting to a string that I have is that when I
attempt to convert a social security number or any other numbers into
a string, it truncates any leading zero's.
tostring ssn, gen(ssnstr)
Thanks.
Mike
On Mon, Feb 6, 2012 at 8:38 AM, Nick Cox <[email protected]> wrote:
> Is this a general question, or a specific question about Austin Nichols' -outfixt-?
>
> In general: Convert to string first.
>
> Nick
> [email protected]
>
> Michael Eisenberg
>
> Thanks so much.
>
> Is there a way to replace missing values with no characters rather than a "." ?
>
>
>
> On Tue, Jan 17, 2012 at 7:05 AM, Austin Nichols <[email protected]> wrote:
>> Michael Eisenberg <[email protected]>:
>> replace lastname=substr(lastname,1,20)
>> *etc, then:
>> ssc install outfixt
>>
>> On Tue, Jan 17, 2012 at 9:56 AM, Michael Eisenberg
>> <[email protected]> wrote:
>>> Colleagues,
>>>
>>> I have to prepare a file for a linkage project, and I’m hoping stata can assist.
>>>
>>> Currently my data is in a stata data file.
>>>
>>> The linkage company requires a set format of data in a plain text format.
>>>
>>> The format assumes 100 characters per line. Where () represents which
>>> line characters are assigned to a given field. If a variable has
>>> more characters than the designated number of characters, it is to be
>>> truncated
>>>
>>> (1-20) LAST NAME
>>> (21-35) FIRST NAME
>>> (36) MIDDLE INITIAL
>>> (37-45) SSN
>>> (46-47) MONTH OF BIRTH
>>> (48-49) DAY OF BIRTH
>>> (50-53) YEAR OF BIRTH
>>>
>>> The data currently looks like this
>>>
>>> Lastname firstname middlename SSN MonOB DaOB YrOB
>>> Smith John Thomas 122342789 01 04 1947
>>> Jones Craig Harvey 600656785 10 24 1957
>>> Stata Jim Smith 423456751 12 06 1970
>>> Johnson Mike Thomas 056445671 01 16 1971
>>>
>>> Can Stata perform such a transformation? If not, are there other
>>> programs that could be recommended.
>
> *
> * 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/