<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Happy Valentines Day:  A Dozen Polar Roses in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Happy-Valentines-Day-A-Dozen-Polar-Roses/m-p/250167#M9067</link>
    <description>&lt;P&gt;I was inspired by the blog post,&amp;nbsp;&lt;A href="http://blogs.sas.com/content/iml/2015/12/16/polar-rose.html" target="_blank"&gt;http://blogs.sas.com/content/iml/2015/12/16/polar-rose.html&lt;/A&gt; &amp;nbsp;to make a beautiful Valentine with SAS. &amp;nbsp;I was thinking as well you could also make a data set with people's names and use by group processing to make personalized Valentine's but for now you can see below the basic idea. &amp;nbsp;I had fun make these. &amp;nbsp;The roses are random, so each time you run the macro you get slight differences in the selection of roses. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/1894i005FD0D05AB49266/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="img0.png" title="img0.png" /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* rose picture*/
ods graphics/reset=all;
ods graphics/ imagefmt=png;
options device=png;

options nodate nonumber;

*ods graphics/ height=6.5in noborder;
ods pdf gtitle gfootnote
	file="n:\rose_card.pdf"
	 startpage=no ;
title;
ODS USEGOPT ;
%macro makecard(for=Todd,from=Mom);

	data Roses;
		/* the array below has a list of multipliers that make 
		pretty roses, it is temporary, so will not be saved
		with the data*/
		array klist{11} _temporary_ (4, 5, 6, 1.5, 2.5, 1.333333, 2.33333, .75, 1.25, 1.2, .8333333);

		do flower=1 to 12;
			n = ceil( 11*rand("Uniform") );

			/*pick a random number
			between 1 and 11*/
			k=klist{n}; /*assign k to be the nth multiplier*/

			/* draw the rose r=cos(k * theta) */
			do theta = 0 to 12*constant("pi") by 0.1;
				r = cos(k * theta);      /* generalized rose */
				x = r*cos(theta);        /* convert to Euclidean coords */
				y = r*sin(theta);

				/*move the rose to the right spot*/
				if flower &amp;lt;= 5 then
					do;
						cx=2*flower+1;
						cy=9;
					end;
				else if 6&amp;lt;= flower&amp;lt;=9 then
					do;
						cx=(2*flower-8);
						cy=10.5;
					end;
				else if 10&amp;lt;= flower&amp;lt;=12 then
					do;
						cx=(2*flower-15);
						cy=12;
					end;

				x=x+cx;
				y=y+cy;
				group=flower;
				output;

				/*make the stem*/
				group=-flower;
				x=cx;
				y=cy;
				output;
				x=7;
				y=3;
				output;
			end;
		end;

		/*bow*/
		do theta = constant("pi")*7.5/12 to constant("pi")*28.5/12 by 0.01;
			r = cos(2 * (theta));       /* rose */
			x = r*cos(theta);          /* convert to Euclidean coords */
			y = r*sin(theta);
			group=100;

			if y&amp;lt;abs(x) then
				do;
					x=x+7;
					y=y+3;
					output;
				end;
		end;
	run;

	proc sort data=roses;
		by group;
		title1 "Happy Valentines Day &amp;amp;for" ;
		title2 "A Dozen Random Polar Roses for You" ;

	proc sgplot data=Roses aspect=1 noautolegend
			noborder nowall;
		styleattrs datacontrastcolors=
			( 
			green green green green
			green green green green
			green green green green
			red  bippk red purple bippk 
			blue purple  bippk red purple  blue red
			crimson 
				) datalinepatterns=(1);
		series x=x y=y /group=group;
		xaxis min=0 max=15 display=none;
		yaxis min=0 max=15 display=none;
		footnote "Lots of Love, &amp;amp;from";
		footnote2 " ";
		footnote3 " ";
		footnote4 " ";
		footnote5 " Polar Roses: r = cos(k*theta)";
		footnote6 " Generated with the SAS System 9.4";
		footnote7 "initial idea: http://blogs.sas.com/content/iml/2015/12/16/polar-rose.html";
	run;
	title;
	footnote;

%mend;

    %makecard(for=Todd ,from=Laura);

ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 15 Feb 2016 20:02:01 GMT</pubDate>
    <dc:creator>LauraRK</dc:creator>
    <dc:date>2016-02-15T20:02:01Z</dc:date>
    <item>
      <title>Happy Valentines Day:  A Dozen Polar Roses</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Happy-Valentines-Day-A-Dozen-Polar-Roses/m-p/250167#M9067</link>
      <description>&lt;P&gt;I was inspired by the blog post,&amp;nbsp;&lt;A href="http://blogs.sas.com/content/iml/2015/12/16/polar-rose.html" target="_blank"&gt;http://blogs.sas.com/content/iml/2015/12/16/polar-rose.html&lt;/A&gt; &amp;nbsp;to make a beautiful Valentine with SAS. &amp;nbsp;I was thinking as well you could also make a data set with people's names and use by group processing to make personalized Valentine's but for now you can see below the basic idea. &amp;nbsp;I had fun make these. &amp;nbsp;The roses are random, so each time you run the macro you get slight differences in the selection of roses. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/1894i005FD0D05AB49266/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="img0.png" title="img0.png" /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* rose picture*/
ods graphics/reset=all;
ods graphics/ imagefmt=png;
options device=png;

options nodate nonumber;

*ods graphics/ height=6.5in noborder;
ods pdf gtitle gfootnote
	file="n:\rose_card.pdf"
	 startpage=no ;
title;
ODS USEGOPT ;
%macro makecard(for=Todd,from=Mom);

	data Roses;
		/* the array below has a list of multipliers that make 
		pretty roses, it is temporary, so will not be saved
		with the data*/
		array klist{11} _temporary_ (4, 5, 6, 1.5, 2.5, 1.333333, 2.33333, .75, 1.25, 1.2, .8333333);

		do flower=1 to 12;
			n = ceil( 11*rand("Uniform") );

			/*pick a random number
			between 1 and 11*/
			k=klist{n}; /*assign k to be the nth multiplier*/

			/* draw the rose r=cos(k * theta) */
			do theta = 0 to 12*constant("pi") by 0.1;
				r = cos(k * theta);      /* generalized rose */
				x = r*cos(theta);        /* convert to Euclidean coords */
				y = r*sin(theta);

				/*move the rose to the right spot*/
				if flower &amp;lt;= 5 then
					do;
						cx=2*flower+1;
						cy=9;
					end;
				else if 6&amp;lt;= flower&amp;lt;=9 then
					do;
						cx=(2*flower-8);
						cy=10.5;
					end;
				else if 10&amp;lt;= flower&amp;lt;=12 then
					do;
						cx=(2*flower-15);
						cy=12;
					end;

				x=x+cx;
				y=y+cy;
				group=flower;
				output;

				/*make the stem*/
				group=-flower;
				x=cx;
				y=cy;
				output;
				x=7;
				y=3;
				output;
			end;
		end;

		/*bow*/
		do theta = constant("pi")*7.5/12 to constant("pi")*28.5/12 by 0.01;
			r = cos(2 * (theta));       /* rose */
			x = r*cos(theta);          /* convert to Euclidean coords */
			y = r*sin(theta);
			group=100;

			if y&amp;lt;abs(x) then
				do;
					x=x+7;
					y=y+3;
					output;
				end;
		end;
	run;

	proc sort data=roses;
		by group;
		title1 "Happy Valentines Day &amp;amp;for" ;
		title2 "A Dozen Random Polar Roses for You" ;

	proc sgplot data=Roses aspect=1 noautolegend
			noborder nowall;
		styleattrs datacontrastcolors=
			( 
			green green green green
			green green green green
			green green green green
			red  bippk red purple bippk 
			blue purple  bippk red purple  blue red
			crimson 
				) datalinepatterns=(1);
		series x=x y=y /group=group;
		xaxis min=0 max=15 display=none;
		yaxis min=0 max=15 display=none;
		footnote "Lots of Love, &amp;amp;from";
		footnote2 " ";
		footnote3 " ";
		footnote4 " ";
		footnote5 " Polar Roses: r = cos(k*theta)";
		footnote6 " Generated with the SAS System 9.4";
		footnote7 "initial idea: http://blogs.sas.com/content/iml/2015/12/16/polar-rose.html";
	run;
	title;
	footnote;

%mend;

    %makecard(for=Todd ,from=Laura);

ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 20:02:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Happy-Valentines-Day-A-Dozen-Polar-Roses/m-p/250167#M9067</guid>
      <dc:creator>LauraRK</dc:creator>
      <dc:date>2016-02-15T20:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: Happy Valentines Day:  A Dozen Polar Roses</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Happy-Valentines-Day-A-Dozen-Polar-Roses/m-p/250177#M9068</link>
      <description>&lt;P&gt;This post *totally* makes my day, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/38972"&gt;@LauraRK﻿&lt;/a&gt;! Love what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS﻿&lt;/a&gt;&amp;nbsp;did for Valentine's Day 2015:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Analytics-U/Give-A-Geeky-Valentine/m-p/164135/highlight/true#M806" target="_blank"&gt;https://communities.sas.com/t5/SAS-Analytics-U/Give-A-Geeky-Valentine/m-p/164135/highlight/true#M806&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 20:21:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Happy-Valentines-Day-A-Dozen-Polar-Roses/m-p/250177#M9068</guid>
      <dc:creator>BeverlyBrown</dc:creator>
      <dc:date>2016-02-15T20:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: Happy Valentines Day:  A Dozen Polar Roses</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Happy-Valentines-Day-A-Dozen-Polar-Roses/m-p/332297#M11578</link>
      <description>&lt;P&gt;Happy Valentines Day, just bumping this up, as it is that time of year again.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 19:07:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Happy-Valentines-Day-A-Dozen-Polar-Roses/m-p/332297#M11578</guid>
      <dc:creator>LauraRK</dc:creator>
      <dc:date>2017-02-13T19:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: Happy Valentines Day:  A Dozen Polar Roses</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Happy-Valentines-Day-A-Dozen-Polar-Roses/m-p/535404#M17793</link>
      <description>&lt;P&gt;Hi, I added an update&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anim.gif" style="width: 384px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/27132iBFA880A1ED6BA9CD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Anim.gif" alt="Anim.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* rose picture with animation*/
%let for=You;
%let from=Laura;
title;
footnote;
%let outpath=W:\valentines;

ods graphics / imagefmt=GIF width=4in height=5in;     /* each image is 4in x 5in GIF */
options papersize=('4 in', '5 in')                    /* set size for images */
        nodate nonumber                               /* do not show date, time, or frame number */
        animduration=0.5 animloop=yes noanimoverlay   /* animation details */
        printerpath=gif animation=start;              /* start recording images to GIF */
ods printer file="&amp;amp;outpath\Anim.gif";  /* images saved into animated GIF */

%macro makedata;
	data Roses;
		/* the array below has a list of multipliers that make 
			pretty roses, it is temporary, so will not be saved
			with the data*/
		array klist{11} _temporary_ (4, 5, 6, 1.5, 2.5, 1.333333, 2.33333, .75, 1.25, 1.2, .8333333);
		
		do flower=1 to 12;
			n = ceil( 11*rand("Uniform") );
			/*pick a random number
					between 1 and 11*/
			k=klist{n}; /*assign k to be the nth multiplier*/

			/* draw the rose r=cos(k * theta) */
			do theta = 0 to 12*constant("pi") by 0.1;
				r = cos(k * theta);      /* generalized rose */
				x = r*cos(theta);        /* convert to Euclidean coords */
				y = r*sin(theta);

				/*move the rose to the right spot*/
				if flower &amp;lt;= 5 then
					do;
						cx=2*flower+1;
						cy=9;
					end;
				else if 6&amp;lt;= flower&amp;lt;=9 then
					do;
						cx=(2*flower-8);
						cy=10.5;
					end;
				else if 10&amp;lt;= flower&amp;lt;=12 then
					do;
						cx=(2*flower-15);
						cy=12;
					end;

				x=x+cx;
				y=y+cy;
				group=flower;
				do i=0 to flower; output; end;

				/*make the stem*/
				group=flower+.5;
				x=cx;
				y=cy;
				do i=0 to flower; output; end;
				x=7;
				y=3;
				do i= 0 to flower; output; end;
			end;
		end;

		/*bow*/
		do theta = constant("pi")*7.5/12 to constant("pi")*28.5/12 by 0.01;
			r = cos(2 *(theta));       /* rose */
			x = r*cos(theta);          /* convert to Euclidean coords */
			y = r*sin(theta);
			group=100;
			i=0;
			if y&amp;lt;abs(x) then
				do;
					x=x+7;
					y=y+3;
					output;
				end;
		end;
	run;

%mend;

%makedata;
data roses2 ;
  set roses;
  i=13-i;
run;

proc sort data=roses2;
	by i group;
run;


options nobyline;
proc sgplot data=Roses2  aspect=1 noautolegend
	noborder nowall noopaque;;
	by i;
	styleattrs datacontrastcolors=
		( 
		red green 
		 bippk green red green purple green bippk green
		blue green purple green  bippk green red green purple green
blue green red green
		crimson 
			) datalinepatterns=(1);
	series x=x y=y /group=group;
	xaxis min=1 max=13 display=none;
	yaxis min=2 max=13 display=none;
	title1 "Happy Valentine's Day";
	title2 "A Dozen Random Polar Roses for &amp;amp;for";
	footnote1 "From, &amp;amp;from";
/*	footnote2 " Polar Roses: r = cos(k*theta)";
	footnote3 " Generated with the SAS System 9.4";
	footnote4 "see: http://blogs.sas.com/content/iml/2015/12/16/polar-rose.html";
*/
	run;
                                /* restore screen output */
 
options printerpath=gif animation=stop;               /* stop recording images */
ods printer close;   

title;
footnote;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Feb 2019 20:34:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Happy-Valentines-Day-A-Dozen-Polar-Roses/m-p/535404#M17793</guid>
      <dc:creator>LauraRK</dc:creator>
      <dc:date>2019-02-13T20:34:52Z</dc:date>
    </item>
  </channel>
</rss>

