Date: Tue, 9 Jul 1996 20:07:37 GMT
Reply-To: "M.R. Stewart" <at508@FreeNet.Carleton.CA>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: "M.R. Stewart" <at508@FREENET.CARLETON.CA>
Organization: The National Capital FreeNet
Subject: Re: extracting the 1st 2 digits of a variable
Giovanni Ferro-Luzzi (email@example.com) writes:
> Hi SASlers,
> How can I create a new variable from another one by taking only the first
> 2 digits, e.g.
> Var X ---> Var Y
> 123204 ---> 12
> 345056 ---> 34
> (For completeness, the numbers are industry and occupations classifications
> codes, but I only need the higher more aggregated levels).
> Thanks in advance for any information,
There may be more elegant solutions, but I would do this.
data yyy; set xxx;
length z $ 6;
Works for me!