Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Mathematics
General TopicsResearchOperations ResearchStatisticsMathematical LogicNumerical AnalysisUndergraduate MathAlgebra HelpRecreational Math
Math Software
MapleMathematicaMATLABScilabSASSPSS

Math Forum / Math Software / SAS / July 2009



Tip: Looking for answers? Try searching our database.

a very simple question: base

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
skyline - 03 Jul 2009 08:57 GMT
Hello,
A very simple question:

suppose I have a dataset test such as

year month variable1
2008 1        10
2008  2       5
2009  1       5
2009  2       3

then I run

proce means data=test2;
var variable1;
by year;
output out=test2 mean=variable2;
run;
to get (roughly)

year variable2
2008  7.5
2009  4

from the previous post, I now know how to get

year variable1
2007  10
2009  5
2009  3

now I would like to get to use the 2007 value as a base so that

year variable1 ratio
2007 10          1
2008  5           0.5
2009  3           0.3

Please advise.
inason - 03 Jul 2009 14:23 GMT
> Hello,
> A very simple question:
[quoted text clipped - 35 lines]
>
> Please advise.
Didn't fully understand what you needed.
so further explaination maybe needed for example
Where does the 2007 come from and what do mean by use it as a base,
and what is the ratio of.
Arthur Tabachneck - 03 Jul 2009 15:23 GMT
If the problem is as simple as you describe, you may be able to solve it
with something like:

data have;
 input year variable1;
 cards;
2007  10
2009  5
2009  3
;

data want (drop=base);
 set have;
 retain base;
 if year eq 2007 then do;
   base=variable1;
 end;
 ratio=variable1/base;
run;

HTH,
Art
---------

>Hello,
>A very simple question:
[quoted text clipped - 35 lines]
>
>Please advise.
Nat Wooding - 03 Jul 2009 22:55 GMT
I second Art's suggestion about using a retain statement.

Another way to write the if statement would be

if _n_ = 1 then base = variable1;

This assumes that you always want to use the first observation as the
divisor.

Nat Wooding
Environmental Specialist III
Dominion, Environmental Biology
4111 Castlewood Rd
Richmond, VA 23234
Phone:804-271-5313, Fax: 804-271-2977
      Cel Phone: 804-205-0752

            Arthur Tabachneck
            <art297@NETSCAPE.
            NET>                                                       To
            Sent by: "SAS(r)          SAS-L@LISTSERV.UGA.EDU
            Discussion"                                                cc
            <SAS-L@LISTSERV.U
            GA.EDU>                                               Subject
                                      Re: a very simple question: base

            07/03/2009 10:23
            AM

            Please respond to
            Arthur Tabachneck
            <art297@NETSCAPE.
                  NET>

If the problem is as simple as you describe, you may be able to solve it
with something like:

data have;
 input year variable1;
 cards;
2007  10
2009  5
2009  3
;

data want (drop=base);
 set have;
 retain base;
 if year eq 2007 then do;
   base=variable1;
 end;
 ratio=variable1/base;
run;

HTH,
Art
---------

>Hello,
>A very simple question:
[quoted text clipped - 35 lines]
>
>Please advise.

CONFIDENTIALITY NOTICE:  This electronic message contains
information which may be legally confidential and or privileged and
does not in any case represent a firm ENERGY COMMODITY bid or offer
relating thereto which binds the sender without an additional
express written confirmation to that effect.  The information is
intended solely for the individual or entity named above and access
by anyone else is unauthorized.  If you are not the intended
recipient, any disclosure, copying, distribution, or use of the
contents of this information is prohibited and may be unlawful.  If
you have received this electronic transmission in error, please
reply immediately to the sender that you have received the message
in error, and delete it.  Thank you.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.