Hi,

I have a question about how to import a .txt file filled with a SPSS code into Stata. Is there in any way an option that stata can read this file or recode it into something stata compatible?

Thank you very much!

I have a question about how to import a .txt file filled with a SPSS code into Stata. Is there in any way an option that stata can read this file or recode it into something stata compatible?

Thank you very much!

Code:

utility=function(PF,RLSF,VIT,PAIN,MH,RL){ Most=as.numeric() Most=ifelse(PF==3|RL==3|RL==4|SF==4|SF==5|PAIN==4|PAIN==5|MH==4|MH==5|VIT==4|VIT==5,1,0) PF1=as.numeric() RL_1=as.numeric() SF1=as.numeric() PAIN1=as.numeric() MH1=as.numeric() VIT1=as.numeric() Most1=as.numeric() for (i in 1:length(PF)){ if(PF[i]==1)PF1[i]=0 if(PF[i]==2)PF1[i]=0 if(PF[i]==3)PF1[i]=-0.045 if(RL[i]==1)RL_1[i]=0 if(RL[i]==2)RL_1[i]=-0.063 if(RL[i]==3)RL_1[i]=-0.063 if(RL[i]==4)RL_1[i]=-0.063 if(SF[i]==1)SF1[i]=0 if(SF[i]==2)SF1[i]=-0.063 if(SF[i]==3)SF1[i]=-0.066 if(SF[i]==4)SF1[i]=-0.081 if(SF[i]==5)SF1[i]=-0.093 if(PAIN[i]==1) PAIN1[i]=0 if(PAIN[i]==2) PAIN1[i]=0 if(PAIN[i]==3) PAIN1[i]=-0.042 if(PAIN[i]==4) PAIN1[i]=-0.077 if(PAIN[i]==5) PAIN1[i]=-0.137 if(MH[i]==1)MH1[i]=0 if(MH[i]==2)MH1[i]=-0.059 if(MH[i]==3)MH1[i]=-0.059 if(MH[i]==4)MH1[i]=-0.113 if(MH[i]==5)MH1[i]=-0.134 if(VIT[i]==1)VIT1[i]=0 if(VIT[i]==2)VIT1[i]=-0.078 if(VIT[i]==3)VIT1[i]=-0.078 if(VIT[i]==4)VIT1[i]=-0.078 if(VIT[i]==5)VIT1[i]=-0.106 if (Most[i]==0)Most1[i]=0 if (Most[i]==1)Most1[i]=-0.077 } QoL=1+PF1+RL_1+SF1+PAIN1+MH1+VIT1+Most1 return(QoL) }

## Comment