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 (April 2006, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 11 Apr 2006 17:04:33 +0000
Reply-To:     toby dunn <tobydunn@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         toby dunn <tobydunn@HOTMAIL.COM>
Subject:      Re: ADDING VARIABLES - A,B,D instead of A,B,C
Comments: To: mehedisas@YAHOO.COM
In-Reply-To:  <200604111646.k3BF2iA3011826@mailgw.cc.uga.edu>
Content-Type: text/plain; format=flowed

MD ,

The easist way is to use a retain statement. If the vars are in the Data set then nothing happens if they are not then they are created.

data one ; infile cards ; input A B D ; cards ; 1 1 1 2 2 2 3 3 3 ; run ;

data two ; set one ; Retain C E . ; run ;

proc print data = Two ; run ;

Toby Dunn

From: Md Alam <mehedisas@YAHOO.COM> Reply-To: Md Alam <mehedisas@YAHOO.COM> To: SAS-L@LISTSERV.UGA.EDU Subject: Re: ADDING VARIABLES - A,B,D instead of A,B,C Date: Tue, 11 Apr 2006 12:46:50 -0400

SORRY IT SHOULD A, B & D instate of A, B & C. SO PLEASE REFFER TO THE CORRECT ONE AS FOLLOWS:

I have variables A, B & C as follows in a dataset:

A B D 1 1 1 2 3 5 9 1

I need to check if varibales C & E exits in that dataset. If variable C & E is not in that dataset then have those two variables as follows without any values for C & E:

A B C D E 1 1 1 2 3 5 9 1

Thanks in advance to write this code.


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