'분류 전체보기'에 해당되는 글 38건

Paired t-test
data pressure;
         input SBPbefore SBPafter @@;
         datalines;
   120 128   124 131   130 131   118 127
   140 132   128 125   140 141   135 137
   126 118   130 132   126 129   127 135
   ;
   run;


ods graphics on; proc ttest; paired SBPbefore*SBPafter; run;

ods graphics off;


Paired t-test using PROC MIXED procedure

ref-1

proc mixed method=type3; 

 class pt paired; 

 model y = paired / ddfm=kenwardroger; 

 random pt; 

 lsmean paired / tdiff cl; 

run; 



data conc2a conc2b; set conc2 ;

if (order1 = 2 or order1 =3) ;

if trt = "R" then output conc2a;

if trt = "T" then output conc2b ;


run ;


%macro ttest(aaa);

 proc mixed data = conc2&aaa method=type3;

 class subject  order1 ;

 model conc  = order1 / ddfm=kenwardroger; 

random subject  ;

 lsmean order1/ tdiff cl; 

run; 


%mend ;

%ttest(a);

%ttest(b);

 

Unpaired t-test

proc ttest data = mainlib.file1; var _numeric_; class buy_ind; run;

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

SAS Procedure 들  (0) 2019.03.03
Call R Graphics from PROC IML (R graph 부르기)  (0) 2019.02.14
MACRO 사용하기  (0) 2018.11.28
proc FORMAT  (0) 2018.11.28
ODS 특수문자 입력 (ODS escapechar)  (0) 2018.11.26
블로그 이미지

고향이안드로메다

,

Ref 1

Ref 2


자동으로 순서만들기

data lab3 ; set lab1 ;  

N = _N_  ;

if trt2 = 0 then N1 = 0;

else if trt2 = 1 then N1 = N-1 ;

else if trt2 = 2 then N1 = N-12 ;

else if trt2 = 99 then N1 =99;

run ;


자동으로 순서만들기 참조 1


data company;
   infile cards dsd
   
input company_code :$12.  sector &$50.
   
cards
AN8068571086,Primary sector   
ANN6748L1027,Machinery, equipment, furniture, recycling
BMG0129K1045,Other services
BMG029951016,Other services
BMG0464B1072,Other services
BMG0692U1099,Other services
BMG100821401,Primary sector
BMG169621056,Food, beverages, tobacco
BMG200452024,Other services
BMG303971060,Other services
;;;;
   run
proc print
   
run
proc summary data=company nway
   
class sector;
   output out=sectorCode(rename=(_level_=SectorCode) drop=_type_ _freq_ index=(sector)) / levels
   
run
data company;
   set company;
   set sectorcode key=sector/unique
   
run
proc print
   
run;

블로그 이미지

고향이안드로메다

,

DATA DUMMY;

DO TRT  = 'T', 'R', '9';

     DO AESEV_STD1 = 1 to 3; OUTPUT; 

END; 

END; 

RUN;

블로그 이미지

고향이안드로메다

,

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
블로그 이미지

고향이안드로메다

,