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 2003, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 11 Apr 2003 12:32:28 -0400
Reply-To:     diskin.dennis@KENDLE.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         diskin.dennis@KENDLE.COM
Subject:      Re: Adding variable with constant value to big SAS dataset
Comments: To: Jan Sollmann <jan.sollmann@AXA-FINANCIAL.COM>
Content-type: text/plain; charset=us-ascii

Jan,

It depends on what you are going to do with the new dataset. As Roland pointed out, The retain is somewhat more efficient than an assignment statement. If you are creating the new dataset just to input into a process, then you could create a view instead. For example:

data a / view=a; set b; retain new_var 'constant'; run;

Otherwise, if you actually need the dataset changed the, no you must read in the entire old dataset and write out the new one.

HTH, Dennis Diskin

From: Jan Sollmann <jan.sollmann@AXA-FINANCIAL.COM>@LISTSERV.UGA.EDU> on 04/11/2003 12:08 PM

Please respond to Jan Sollmann <jan.sollmann@AXA-FINANCIAL.COM>

Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>

To: SAS-L@LISTSERV.UGA.EDU cc:

Subject: Adding variable with constant value to big SAS dataset

I want to add a new character variable with a constant value to a very big existing dataset. The obvious way to do this would be:

data a; set b; new_var='constant'; run;

Is there a way to achieve this without inputing the whole dataset, which is very time consuming?


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