help needed for a data transformation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

help needed for a data transformation

Luo, Dan
Hi, sorry to bother you.
  could you please help me figure out this syntax?
  I have a variable named "text" which is consisted of 1a, 2a, 3b,...38m...44m..80b etc this kind of values. I need to select out all those ending with  "m" and divide the rest of them into two groups one is  >40 and the other is 4-38.
  greatly appreciated if you could provide some suggestions.



---------------------------------
How low will we go? Check out Yahoo! MessengerÂ’s low  PC-to-Phone call rates.
Reply | Threaded
Open this post in threaded view
|

Re: help needed for a data transformation

Simon Phillip Freidin
compute mindex=index(text,'m').
do if mindex>0.
compute mnumb=number(substr(text,1,mindex-1),f3).
compute mhigh=(mnumb>40).
end if.
sel if range(mhigh,0,1).

mhigh=
0 for 0-40,
1 for 41+ and &
sysmis for non-m cases.


On 23/09/2006, at 6:19 AM, Luo, Dan wrote:

> Hi, sorry to bother you.
>   could you please help me figure out this syntax?
>   I have a variable named "text" which is consisted of 1a, 2a,
> 3b,...38m...44m..80b etc this kind of values. I need to select out
> all those ending with  "m" and divide the rest of them into two
> groups one is  >40 and the other is 4-38.
>   greatly appreciated if you could provide some suggestions.
>
>
>
> ---------------------------------
> How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone
> call rates.
Reply | Threaded
Open this post in threaded view
|

Re: help needed for a data transformation

Edward Boadi
In reply to this post by Luo, Dan
Hi Dan,
The syntax below will select out all the values ending with "m" .

GET File = "File Name".
SELECT IF (  (INDEX(UPCASE(text),'M')= 0 ) ) .
EXECUTE.

Can you explain futher what you mean by "divide the rest of them into two groups one is  >40 and the other is 4-38"

Regards and have a good weekend.
Edward.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]]On Behalf Of
Luo, Dan
Sent: Friday, September 22, 2006 4:20 PM
To: [hidden email]
Subject: help needed for a data transformation


Hi, sorry to bother you.
  could you please help me figure out this syntax?
  I have a variable named "text" which is consisted of 1a, 2a, 3b,...38m...44m..80b etc this kind of values. I need to select out all those ending with  "m" and divide the rest of them into two groups one is  >40 and the other is 4-38.
  greatly appreciated if you could provide some suggestions.



---------------------------------
How low will we go? Check out Yahoo! Messenger's low  PC-to-Phone call rates.