Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Data Logic
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Barry Schwarz  
View profile  
 More options Feb 9, 11:14 pm
Newsgroups: comp.soft-sys.sas
From: Barry Schwarz <schwa...@dqel.com>
Date: Thu, 09 Feb 2012 20:14:13 -0800
Local: Thurs, Feb 9 2012 11:14 pm
Subject: Re: Data Logic

What part are you having trouble with?  Are you using the retain
statement?  The length statement? The output statement?  One of the
CATx functions? The first. and last. automatic variables?

--
Remove del for email


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ajs2004@bigfoot.com  
View profile  
 More options Feb 10, 7:56 am
Newsgroups: comp.soft-sys.sas
From: "ajs2...@bigfoot.com" <ajs2...@bigfoot.com>
Date: Fri, 10 Feb 2012 04:56:06 -0800 (PST)
Local: Fri, Feb 10 2012 7:56 am
Subject: Re: Data Logic
data have;
  input id group value $;
  datalines;
111   1  ABC
111   1  DEF
111   2  GHI
222   1  ABC
222   2  DEF
222   3  GHI
333   1  ABC
333   1  XYZ
;
run;

data want;
  set have;
  length newvar $32; /* make sure it's long enough */
  by id group;
  if (first.group) then newvar = value;
  else newvar = cats(newvar, '/', value);
  if (last.group);
  retain newvar;
run;

proc print data=want;
run;

On Feb 9, 11:48 pm, Al <ali6...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pritty  
View profile  
 More options Feb 17, 1:54 am
Newsgroups: comp.soft-sys.sas
From: Pritty <prithv...@gmail.com>
Date: Thu, 16 Feb 2012 22:54:51 -0800 (PST)
Local: Fri, Feb 17 2012 1:54 am
Subject: Re: Data Logic
Try the following to retain the first value of Value :-

data inp;
input ID Group Value $;
datalines;
 111    1              ABC
 111    1              DEF
 111    2              GHI
 222   1               ABC
 222   2               DEF
 222   3              GHI
 333   1             ABC
 333   1            XYZ
;
run;

proc sort data = inp ;
by id group;
run;

data new2(rename = (test = value));
set inp;
retain test newvar;
by id group;
if first.group then do ;
newvar = value;
test = value;
end;
else newvar = compress(newvar||'/'||value);
if last.group then output;
drop value;
run;


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pritty  
View profile  
 More options Feb 17, 1:57 am
Newsgroups: comp.soft-sys.sas
From: Pritty <prithv...@gmail.com>
Date: Thu, 16 Feb 2012 22:57:08 -0800 (PST)
Local: Fri, Feb 17 2012 1:57 am
Subject: Re: Data Logic
On Feb 10, 5:56 pm, "ajs2...@bigfoot.com" <ajs2...@bigfoot.com> wrote:

For retaining the first obs of value:-

data inp;
input ID Group Value $;
datalines;
 111    1              ABC
 111    1              DEF
 111    2              GHI
 222   1               ABC
 222   2               DEF
 222   3              GHI
 333   1             ABC
 333   1            XYZ
;
run;

proc sort data = inp ;
by id group;
run;

data new2(rename = (test = value));
set inp;
retain test newvar;
by id group;
if first.group then do ;
newvar = value;
test = value;
end;
else newvar = compress(newvar||'/'||value);
if last.group then output;
drop value;
run;


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »