```Date: Mon, 28 Jan 2008 18:18:21 -0500 Reply-To: Arthur Tabachneck Sender: "SAS(r) Discussion" From: Arthur Tabachneck Subject: Re: Macro for transforming a numeric variable Comments: To: Johnita Byrd Johnita, In addition to Nat's always excelent suggestions, I think you may want to input the formula as z8. (i.e., with leading zeros), in case you have any ASIDs that have leading zeros (e.g., 0001); For example: data have; input asid; new_asid = put(mod(asid, 10000)*10000+int(asid/10000),z8.); cards; 11088284 01152232 02010001 ; HTH, Art -------- On Mon, 28 Jan 2008 15:06:21 -0500, Johnita Byrd wrote: >Hello All, > >I am currently working on a project where there is something called an ASID. The ASID consists of eight numbers. For example, 11088284 where 11 represents the month, 08 represents the day and 8284 represents the patient ID. Now, for each patient ID there are at most 6 entries corresponding to the different times that data was collected. I need to transform the sequence of these numbers so that the ASID looks like this, 82841108. In other words, I would need to have the patient ID in the front so that I would be able to cluster all of the patient IDs together so that a repeated measures analysis can be done for each patient. Is there a way for SPSS to do this? There are about 3,000 patients so it will be very time consuming, not to mention a lot of potential errors can occur, if this had to be done by hand. Thanks in advance for any assistance that can be given. > >I figured out a way to do it in SPSS, so I was wondering if I could use the same methodology for SAS. The way that was given to me in SPSS is as follows: > >Compute new_asid = mod(asid, 10000)*10000+trunk(asid/10000). > >Johnita >_________________________________________________________________ >Helping your favorite cause is as easy as instant messaging.?You IM, we give. >http://im.live.com/Messenger/IM/Home/?source=text_hotmail_join ```

Back to: Top of message | Previous page | Main SAS-L page