[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: R: type mismatch/format var

From   "Carlo Lazzaro" <[email protected]>
To   <[email protected]>
Subject   st: R: type mismatch/format var
Date   Sat, 5 Sep 2009 10:26:54 +0200

Dear Cinzia,

if you're interested in replacing letters with numbers, please

replace  prof_1d="10" if  prof_1d=="A".

HTH and Kind Regards,

-----Messaggio originale-----
Da: [email protected]
[mailto:[email protected]] Per conto di Cinzia Rienzo
Inviato: sabato 5 settembre 2009 9.50
A: [email protected]
Oggetto: st: type mismatch/format var

Dear all,

I have a problem with a variable.

the variable is  "prof "and takes the following values: 
0,1,2,3,4,5,6,7,8,9,A,B, R

i get a type mismatch if i do the following:  

 sum lwage if  prof_1d==1
type mismatch

but it allows me the sum if i write :

 sum lwage if  prof_1d=="1"

    Variable |       Obs        Mean    Std. Dev.       Min        Max
       lwage |     18608    1.564116    .5385916  -2.387844   5.754426

The format of the variable is:

  variable name  display format
  prof_1d        %1s

I tried to change the format but it does not work out:

destring  prof_1d, replace float
prof_1d contains nonnumeric characters; no replace

I also tried to replace letter in numbers:
replace  prof_1d=10 if  prof_1d=="A"
type mismatch

. replace  prof_1d=10 if  prof_1d==A
A not found

How can i deal with this considering that i need the variable in a 

I appreciate any help,

Thanks you all in advance,


*   For searches and help try:

*   For searches and help try:

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