John D. Cook shared a picture of "pretty squiggles" on his blog, as well as a prose description of the mathematics behind it.
I'm more of a programmer than a mathematician, but I've attempted to transcribe his description into a SAS program. I used DATA step to generate the point values, and then PROC SGPLOT and the SERIES statement to plot them.
/* Create a data set with the 3 sets of data points */ data squiggle; do time=-100 to 100 by 0.01; blue = sin(time); /* hope I've got the golden ratio (phi) correct */ green = 0.7 * sin( ((1+sqrt(5))/2) * time ); red = blue+green; output; end; run; ods graphics / width=2000 height=200; /* Plot the data using a series of SERIES plots */ proc sgplot data=squiggle noautolegend; series x=time y=blue / lineattrs=(color=blue pattern=solid); series x=time y=green / lineattrs=(color=green pattern=solid); series x=time y=red / lineattrs=(color=red pattern=solid); xaxis display=none ; yaxis display=none ; run; |
As a variation, I included a "filled" version of the plot using the BAND statement instead of SERIES.
/* a variation that uses a BAND plot instead */ proc sgplot data=squiggle noautolegend; band x=time lower=0 upper=blue / transparency=0.6 fillattrs=(color=blue); band x=time lower=0 upper=green / transparency=0.6 fillattrs=(color=green); band x=time lower=0 upper=red / transparency=0.6 fillattrs=(color=red); xaxis display=none; yaxis display=none grid; run; |
I don't understand all of the topics that John covers in his blog, but I'm a regular reader anyway. As with Rick Wicklin's blog, I tend to feel smarter while I read it, even though I don't have the ability to explain what I've read to anyone else.
4 Comments
Hi Chris,
Thanks for posting helpful SAS information!
I read your posting about installing SAS on window7,
http://www.sascommunity.org/wiki/SAS_9.2_and_SAS_Enterprise_Guide_4.2_on_Windows_7
and followed everything, thus I still see "SAS Syntax Editor control not installed" when I try to open the editor.
Do you have any idea how to fix this?
http://support.sas.com/kb/2/526.html
I found this info as well, but it doesn't have info about window7.
Thanks for reading my question!
Hope you can help me ;_;
I suspect that the issue has to do with one of the Microsoft C runtime components not being installed.
SAS has long supported Windows 7 now with later releases, so if you can, you should try a later version of SAS. But if you cannot, you may need to go back and install Microsoft Visual C 2005 runtime, and then either reinstall the Enhanced Editor component or reregister the component as per the instructions in the SAS note.
The golden ratio looks right to me. The golden ratio has an interesting connection to Fibonacci numbers. If you really want to blow your mind, it is also related to the eigenvalues of a particular matrix that describes the dynamics of a simple model of population growth. #MindBlown
Just reading Rick's comments makes me feel smarter.