LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2003, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 2 May 2003 13:03:49 +0100
Reply-To:     richard.simhon@ALLIANZCORNHILL.CO.UK
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "(Richard Simhon)" <richard.simhon@ALLIANZCORNHILL.CO.UK>
Subject:      Re: Formatting the output
Comments: To: rune@FASTLANE.NO
Content-Type: text/plain

Rune,

This is a piece of code that Charles Patridge sent out a couple of years ago following a similar question by another SAS-l user.

Hope this is of some help!

data Test; infile cards missover; length string $ 5. ; input string $char5. ; /*** assume blanks to be 0s ***/ /*** assumption that input position represents question no.***/

/*** translate blanks to zeroes ***/ string = translate(string, '0', ' ');

/*** break STRING into 5 separate variables ***/ array str(*) $1 str1-str5; do i= 1 to dim(str); str(i) = substr(string,i,1); end; drop i; cards; 0 11010 1101 111 ;;;; run;

results are: 00000 11010 01101 00111

Richard Simhon Business Analyst Allianz Cornhill Personal Lines Tel: +44 (0) 1483 552628 Fax: +44 (0) 1483 552424 Email: Richard.Simhon@allianzcornhill.co.uk

> -----Original Message----- > From: Rune Runnestoe [SMTP:rune@FASTLANE.NO] > Sent: 02 May 2003 12:55 > To: SAS-L@LISTSERV.UGA.EDU > Subject: Formatting the output > > Hello, > > The columns Year and SeqNo are both numeric. When I run the following > code... > > proc sql; > select SeqNo, Year > from Mytable > order by Year, SeqNo; > > ...the output shows like this: > > SeqNo Year > --------------- > 232 2003 > 233 2003 > > But I want it to look like this: > > Missing Lopenr > --------------- > 000232/2003 > 000233/2003 > > > How do I code that ? How do I fill up with leading zeros in the SeqNo ? > > Regards > Rune Runnestoe

************************************************************ Copyright in this message and any attachments remains with us. It is confidential and may be legally privileged. If this message is not intended for you it must not be read, copied or used by you or disclosed to anyone else. Please advise the sender immediately if you have received this message in error.

Although this message and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by Allianz Cornhill Insurance plc for any loss or damage in any way arising from its use.

Cornhill Life, Cornhill Direct and Allianz Global Risks are trading names of Allianz Cornhill Insurance plc.

Petplan and DBI are part of the Allianz Cornhill group of companies.

Allianz Cornhill Insurance plc, Registered in England number 84638. Registered Office: 57 Ladymead, Guildford, Surrey GU1 1DB.

Allianz Cornhill Insurance plc is authorised and regulated by the Financial Services Authority.

Member of the General Insurance Standards Council for general insurance business. ************************************************************


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