'통계 clinical trial/SAS'에 해당되는 글 25건

ref 1.

ref 2.

ref 3.

download

SlaughteDelwiche-MacroProgramming.pdf

Five way


 Retrieving Macro Variables in the DATA Step

 

 

DATA Step에서 매크로 변수값을 불어오는 함수(SYMGET)

 


CALL SYMPUTX 함수는 DATA Step에서 프로그램이 실행되는 동안 생성되는 결과를 매크로 변수에 할당하는 역할

 

SYMGET 함수DATA Step이 실행하는 동안 위에서 생성한 매크로 변수에 지정된 값을 불러오는 역할 .

(아래 그림에서 볼 수 있듯이,

Symbol Table에 있는 매크로 변수에 해당하는 값들을 DATA Step 변수로 가져올 수 있습니다.) 




 

 

 

 

SYMGET 함수의 형태는 다음과 같습니다.

 

 

 

Macro-variable 자리에는 문자” 혹은 DATA step 문자표현 올 수 있습니다.

 

SYMGET 함수가 불러온 DATA step 변수는 길이(length) 200 bytes(default)인 문자 변수가 됩니다.

물론 미리 변수 길이를 지정해주면 길이를 변경할 수 있습니다. 

 

 

 

 

 

그럼 예시를 통해 실습을 해보겠습니다.

 

먼저 실습에 필요한 자료는 다음과 같이 생성하였습니다.

자료 개수는 3변수는 customer_ID customer_name가 있습니다. 

 

  

  

 


지난 시간에 call symputx를 사용하여

name* 매크로 변수를 만들고 그 값으로는 customer_name 값을 할당하였습니다.

(* customer_ID에 해당함)

 

  

  

 


이번에는 SYMGET 함수를 사용하여 name* 매크로 변수 값들을 다시 불러오도록 하겠습니다.

 

결과를 살펴보면 새로운 변수(Customer_Name2) 

고객의 ID별로 매칭되는 고객명이 알맞게 들어가 있는 것을 볼 수 있습니다.

 

  

  



이상 DATA Step에서 매크로 변수값을 불어오는 SYMGET 함수에 대해 살펴보았습니다.

 

 

감사합니다 ^^

'통계 clinical trial > SAS' 카테고리의 다른 글

Call R Graphics from PROC IML (R graph 부르기)  (0) 2019.02.14
TTEST using proc mixed  (0) 2018.11.30
proc FORMAT  (0) 2018.11.28
ODS 특수문자 입력 (ODS escapechar)  (0) 2018.11.26
Data문 DATA set 분리  (0) 2018.11.21
블로그 이미지

고향이안드로메다

,

reference 1


proc format ;

 value $class

          '1' = 'Group 1' 

    '2' = 'Group 2' 

;


picture xxz . = ' 0' (noedit) other = '009' 

'통계 clinical trial > SAS' 카테고리의 다른 글

TTEST using proc mixed  (0) 2018.11.30
MACRO 사용하기  (0) 2018.11.28
ODS 특수문자 입력 (ODS escapechar)  (0) 2018.11.26
Data문 DATA set 분리  (0) 2018.11.21
PROC SORT를 이용한 중복자료 삭제  (0) 2018.11.16
블로그 이미지

고향이안드로메다

,

참조1   Funny ^Stuff~ in My Code: Using ODS ESCAPECHAR

특수문자집어넣기 (unicode)


ods escapechar='^';


위첨자   a^{super 2} + b^{super 2} = c^{super 2}";   

아래첨자 " C^{sub 8}H^{sub 10}N^{sub 4}O^{sub 2}"

Space 집어넣  ^{NBSPACE 5}



Unicode  (e.g. ’El nin’ unicode ’0303’x )

Commonly Used Unicode and Special Characters




Markers, Marker Names, Unicode Characters, Unicode Specifications



'통계 clinical trial > SAS' 카테고리의 다른 글

MACRO 사용하기  (0) 2018.11.28
proc FORMAT  (0) 2018.11.28
Data문 DATA set 분리  (0) 2018.11.21
PROC SORT를 이용한 중복자료 삭제  (0) 2018.11.16
proc FREQ (in SAS and Excel)  (0) 2018.11.09
블로그 이미지

고향이안드로메다

,

참조 site


DATA AAA BBB ; set zzz;

if qqq= "x1" then output AAA;

if qqq= "x2" then output BBB;

run ;


'통계 clinical trial > SAS' 카테고리의 다른 글

proc FORMAT  (0) 2018.11.28
ODS 특수문자 입력 (ODS escapechar)  (0) 2018.11.26
PROC SORT를 이용한 중복자료 삭제  (0) 2018.11.16
proc FREQ (in SAS and Excel)  (0) 2018.11.09
proc GLM for BE  (0) 2018.11.08
블로그 이미지

고향이안드로메다

,

참고1



PROC SORT DATA=zzz

DUPOUT= xxxx  NODUPKEY 

; BY Title 

; RUN ;


DUPOUT= option can be used to identify duplicate observations before actually removing them from a data set.


PROC SORT DATA=zzz  

DUPOUT=xxx  NODUPRECS 

; BY Title ;

; RUN ;


The DUPOUT= and NODUPRECS options are specified. The resulting output data set contains the duplicate observations for Brave Heart and Rocky because these rows have identical data for all columns.


PROC SORT DATA=zzz  

OUT=xxx  NODUPRECS  ;

; BY Title ;

RUN ;

 

OUT : 중복자료 삭제가 출력물.. 그런데 NODUPRECS하면 똑같은 자료가 있는 것만 삭제하고 출력하도록


PROC SORT DATA=zzz  

OUT=xxx  NODUPKEYS ; 

; BY Title ;

RUN ;


 NODUPKEYS (or NODUPKEY): 중복자료 제외하고 출력하기.. 

'통계 clinical trial > SAS' 카테고리의 다른 글

ODS 특수문자 입력 (ODS escapechar)  (0) 2018.11.26
Data문 DATA set 분리  (0) 2018.11.21
proc FREQ (in SAS and Excel)  (0) 2018.11.09
proc GLM for BE  (0) 2018.11.08
ODS 특수기능  (0) 2018.11.07
블로그 이미지

고향이안드로메다

,

SAS



data xxx;

input   int $   trt  $ no;

datalines;

 mild  R 13

 mode R 0

 sev R 2 

  mild T 13

 mode T 3

 sev T 0

 ;

 run;


 proc freq data = xxx ;

 weight no ;

 tables  trt *int /chisq ;

 run ;



data respire; input treat $ outcome $ count ; 

cards; 

test f 40 

test u 20 

placebo f 16 

placebo u 48; 


proc freq; 

weight count; 

tables treat*outcome/measures chisq; 

run;


sas 카이제곱검정에 대한 이미지 검색결과



 참고파일

Sas_web.pdf



#SAS Code for Confidence Intervals for a Proportion


data veg; 

  input response $ count; datalines; 

       no 25 yes 0 ; 

run ;


proc freq data=veg; 

  weight count; tables response / binomial(ac wilson exact jeffreys) alpha=.05; 

run;


#SAS Code for Chi-Squared, Measures of Association, and Residuals for Data on Education

data table; 

  input degree belief $ count @@; 

  datalines; 1 1 9 1 2 8 1 3 27 1 4 8 1 5 47 1 6 236 2 1 23 2 2 39 2 3 88 2 4 49 2 5 179 2 6 706 3 1 28 3 2 48 3 3 89 3 4 19 3 5 104 3 6 293 ; 

run ;

proc freq order=data; 

 weight count; tables degree*belief / chisq expected measures cmh1; 

run ;


proc genmod order=data; class degree belief; model count = degree belief / dist=poi link=log residuals; 


run;

 

#: SAS Code for Confidence Intervals for 2×2 Table

data example;

 input group $ outcome $ count @@; 

datalines; placebo yes 2 placebo no 18 active yes 7 active no 13 ; 


proc freq order=data; weight count; 

   tables group*outcome / riskdiff(CL=(WALD MN)) measures; 

       * MN = Miettinen and Nurminen inverted score test; 

run; 


#SAS Code for Fisher’s Exact Test and Confidence Intervals for Odds Ratio

data fisher;

 input poured guess count @@; 

datalines; 1 1 3 1 2 1 2 1 1 2 2 3 ; 


proc freq; weight count; 

tables poured*guess / measures riskdiff; exact fisher or / alpha=.05; 


proc logistic descending; 

freq count; 

model guess = poured / clodds=pl; 

run;


# SAS Code for “Exact” Confidence Intervals for 2×2 Table

data example; 

input group $ outcome $ count @@; 

datalines; placebo yes 2 placebo no 18 active yes 7 active no 13 ; 


proc freq order=data; weight count; 

tables group*outcome ; 

exact or riskdiff(CL=(MN)) ; 

run; 


proc freq order=data; weight count; 

tables group*outcome ; 

exact riskdiff(method=score); 

* exact unconditional inverting two one-sided score tests; 

run; 


#SAS Code for Binary GLMs for Snoring Data

data glm; 

input snoring disease total @@; 

datalines; 

0 24 1379 2 35 638 4 21 213 5 30 254 ; 

proc genmod; model disease/total = snoring / dist=bin link=identity; proc genmod; model disease/total = snoring / dist=bin link=logit LRCI; proc genmod; model disease/total = snoring / dist=bin link=probit; run;

'통계 clinical trial > SAS' 카테고리의 다른 글

Data문 DATA set 분리  (0) 2018.11.21
PROC SORT를 이용한 중복자료 삭제  (0) 2018.11.16
proc GLM for BE  (0) 2018.11.08
ODS 특수기능  (0) 2018.11.07
proc report output 출력 순서..  (0) 2018.11.06
블로그 이미지

고향이안드로메다

,

proc GLM for BE

2018. 11. 8. 23:55

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.


Output 출력물 내용확인하기

  ods trace on;  ---> ods trace off;



ANOVA 등 결과물 출력막기

   ods exclude all ;  ---> ods exclude close ;


코드를 다시 실행할 때 모든 결과물 정리하기  새로운 마음으로//

   dm 'log; clear; odsresults ; clear; output; clear' ;

'통계 clinical trial > SAS' 카테고리의 다른 글

proc FREQ (in SAS and Excel)  (0) 2018.11.09
proc GLM for BE  (0) 2018.11.08
proc report output 출력 순서..  (0) 2018.11.06
proc report에 format 처러하기 및 통계처리  (0) 2018.11.04
Proc Transpose  (0) 2018.11.04
블로그 이미지

고향이안드로메다

,