BookmarkSubscribeRSS Feed

[발렌타이데이 기념] Binary heart in SAS

Started ‎06-14-2020 by
Modified ‎06-14-2020 by
Views 119

* 출처http://blogs.sas.com/content/iml/2015/02/11/binary-heart.html?utm_source=FBPAGE&utm_medium=social&ut...

 

 

Binary heart in SAS.png

 

 

* 소스

/* generate random binary heart similar to xkcd comic: http://xkcd.com/99/ */

data BinaryHeart;

drop Nx Ny t r;

Nx = 21; Ny = 23;

call streaminit(2142015);

do x = -2.6 to 2.6 by 5.2/(Nx-1);

   do y = -4.4 to 1.5 by 6/(Ny-1);

      /* convert (x,y) to polar coordinates (r, t) */

      r = sqrt( x**2 + y**2 );

      t = atan2(y,x);

      /* eqn: blogs.sas.com/content/iml/2011/02/14/a-parametric-view-of-love/ */

      Heart=  (r < 2 - 2*sin(t) + sin(t)*sqrt(abs(cos(t))) / (sin(t)+1.4))

            & (y > -3.5);

      B = rand("Bernoulli", 0.5);

      output;

   end;

end;

run;

 

ods graphics / width=400px height=500px;

title "Happy Valentine's Day";

proc sgplot data=BinaryHeart noautolegend;

   styleattrs datacontrastcolors=(lightgray red);

   scatter x=x y=y / group=Heart markerchar=B markercharattrs=(size=14);

   xaxis display=none offsetmin=0 offsetmax=0.06;

   yaxis display=none; 

run

 

 

 

.**********************************************************

- 통계분석연구회 
- 카페 : http://cafe.daum.net/statsas
- 통계분석연구회(Statistics Analysis Study) 그룹 :https://www.facebook.com/groups/statsas
* 친구 호출 : 답글에서 @다음에 친구 이름이나 페이지명 작성 후 친구 선택
(예 : @통계분석연구회)

#통계 #빅데이터 #통계분석연구회 #데이터과학자 

 

Version history
Last update:
‎06-14-2020 10:05 PM
Updated by:
Contributors

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Article Labels
Article Tags