Date: Wed, 30 Oct 2002 18:59:30 -0500
Reply-To: Art@DrKendall.org
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Arthur J. Kendall" <Arthur.Kendall@VERIZON.NET>
Subject: Re: Syntax to fill blank data
Content-Type: text/plain; charset=us-ascii; format=flowed
Try this syntax to see if it answers your question.
new file.
data list fixed /ID 1-2 Age 9-10(A).
begin data
01 31
02 32
03
04 33
05 65
06
07 60
end data.
list.
missing values age(' ').
value labels age ' ' 'unknown'.
frequencies vars=age.
new file.
data list fixed /ID 1-2 Age 9-10(A).
begin data
01 31
02 32
03
04 33
05 65
06
07 60
end data.
list.
recode age(' '= '-1')(else=copy).
missing values age('-1').
value labels age '-1' 'unknown'.
frequencies vars=age.
Hope this helps.
Art
Art@DrKendall.org
Social Research Consultants
University Park, MD USA
Mahbub Khandoker wrote:
>Thanks Arthur and it's work.
>But when the variable is string than that syntax does not work.
>Do you have any more way to do that for string variable?
>Thanks.
>Mahbub
>
>-----Original Message-----
>From: Arthur J. Kendall
>To: Mahbub Khandoker
>Cc: SPSSX-L@VM.MARIST.EDU
>Sent: 30/10/02 5:08 PM
>Subject: Re: Syntax to fill blank data
>
>Does this address your question? cut and paste the following syntax and
>observe the output.
>*if you just read the data in via list or fixed format the blanks will
>be system missing.
>*you can then recode it to user missing and assign a value label.
>new file.
>data list list /ID Age.
>begin data
>01 31
>02 32
>03
>04 33
>05 65
>06
>07 60
>end data.
>list.
>
>new file.
>data list fixed /ID 1-2 Age 9-10.
>begin data
>01 31
>02 32
>03
>04 33
>05 65
>06
>07 60
>end data.
>list.
>recode age (sysmis = -1) (else=copy).
>missing values age(-1).
>value labels age -1 'unknown'.
>list.
>
>* or you can tell SPSS to treat blank fields as as specific value
>(commonly zero or -1) and define that value as user missing.
>new file.
>set blanks = -1.
>data list fixed /ID 1-2 Age 9-10.
>begin data
>01 31
>02 32
>03
>04 33
>05 65
>06
>07 60
>end data.
>missing values age(-1).
>value labels age -1 'unknown'.
>list.
>
>Hope this helps.
>
>Art
>Art@DrKendall.org
>Social Research Consultants
>University Park, MD USA
>
>Mahbub Khandoker wrote:
>
>
>
>>Hi there,
>>I have a SPSS data file with some data are missing. How can I fill the
>>blank filed by syntax?
>>For example,
>>
>>ID Age
>>01 31
>>02 32
>>03
>>04 33
>>05 65
>>06
>>07 60
>>
>>I want to fill this blank age as sysmiss or "Unknown".
>>Thanks in advance.
>>Mahbub Khandoker
>>
>>
>>
>>
>>
>
>
>
>
>
>