Data is algorithmically generated in the 'mydata' DATA step by applying sinusoidal functions based on the difference between the current date and the birth date.
1 Code Block
ODS & GOPTIONS
Explanation : Configuration of ODS HTML output (adapted for Stored Processes) and definition of global graph parameters (size, fonts, colors) with GOPTIONS.
Explanation : Conversion of birth date (text) to SAS numeric value and calculation of the analysis date range (today +/- 30 days). Storage of these values in macro variables.
Explanation : Generation of biorhythm data. For each day of the period, calculation of sinusoidal values for physical (23 days), emotional (28 days), and intellectual (33 days) cycles.
Copied!
data mydata;
length id $15;
format date date9.;
format value percentn7.0;
d2r=(atan(1)/45); /* degrees to radians conversion factor */
do Date = &startdate to &enddate by 1;
t=Date-&bdate; /* days since birth */
/* similar to value=sin(2*pi * t/23) ... */
Value = sin((t/23)*360*d2r); id='Physical'; output;
Value = sin((t/28)*360*d2r); id='Emotional'; output;
Value = sin((t/33)*360*d2r); id='Intellectual'; output;
end;
run;
1
DATA mydata;
2
LENGTH id $15;
3
FORMAT date date9.;
4
FORMAT value percentn7.0;
5
d2r=(atan(1)/45); /* degrees to radians conversion factor */
6
DO Date = &startdate to &enddate BY1;
7
t=Date-&bdate; /* days since birth */
8
/* similar to value=sin(2*pi * t/23) ... */
9
Value = sin((t/23)*360*d2r); id='Physical'; OUTPUT;
10
Value = sin((t/28)*360*d2r); id='Emotional'; OUTPUT;
11
Value = sin((t/33)*360*d2r); id='Intellectual'; OUTPUT;
12
END;
13
RUN;
4 Code Block
PROC GPLOT
Explanation : Definition of graphical elements (titles, axes, symbols, legend) and creation of the linear biorhythm chart with PROC GPLOT.
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.