SAS編程:ADLB中Standard Units和Conventional Units的處理

在臨床試驗(yàn)中,實(shí)驗(yàn)室指標(biāo)的分析通常涉及Standard Units和Conventional Units。ADLB數(shù)據(jù)集的設(shè)計(jì)基于統(tǒng)計(jì)師給出的TFL Shell,在Shell中,某些指標(biāo)會展示Standard Units和Conventional Units兩種分析結(jié)果??紤]上這一點(diǎn),ADLB的SAS編程中會有對應(yīng)的處理。

不同的項(xiàng)目中,實(shí)驗(yàn)室指標(biāo)數(shù)據(jù)收集的內(nèi)容可能有所區(qū)別,有的項(xiàng)目可能只收集了Standard Units值,有的可能同時(shí)收集了Standard Units和Conventional Units值。對于前者,要展示Conventional Units結(jié)果的分析,編程中需要對LB中的記錄進(jìn)行處理新生成一條記錄,這里的處理還涉及與保存單位換算系數(shù)的數(shù)據(jù)集拼接以及對應(yīng)的計(jì)算。對于后者,需要先判斷收集到的Conventional Units是否與TFLShell中展示的一致,不一致的話依舊需要進(jìn)行換算。

ADLB編程處理中,關(guān)鍵點(diǎn)有兩個(gè):

  1. Standard Units值向Conventional Units的換算。
  2. LB中收集的Standard Units和Conventional Units值通常是在一條記錄中,所以需要判斷對應(yīng)記錄是否需要生成Conventional Units的記錄,若是,需要將一條記錄Derive成兩條;

單位換算中,有以下這些步驟:

  • 判斷收集的Conventional Units是否與TFL Shell中一致(TFL Shell具體的變量信息通常保存在VLM_SPEC 中);
  • 保留不一致變量的信息,以便后續(xù)程序條件判斷;
  • 與保存換算信息的數(shù)據(jù)集拼接,進(jìn)行單位換算。

可以參考以下代碼:

proc sql noprint;
 *Slect the inconsistent conventional units;
  create table inconu as
    select a.*, b.lborresu
    from conu_lb as a
      inner join
      conu_vlm as b
    on a.lbststcd = b. lbststcd
    where a.lbscresu ne b.lborresu

*Save Testcd with inconsistent units into macro var;
  select distinct quote(strip(lbststcd)) into: inconu separated by ", "
    from inconu;

*Get convfact and convunit from CONVUNIT datasets;
  Create table adlb2 as
    select a.*, b.convfact, b.convunit
    from adlb1 as a
      left join
    CONVUNIT as b
    on a.lbststcd = b.sasname
    order by usubjid;
quit;

%put &incou;

*Convert values;
data adlb3;
  set adlb2;
  if lbtestcd in (&incou.) then do;
    if lbstresn ne . then do;
      lbscresn=round(lbstresn * convfact, 0.01);
      lbscresc=strip(put(lbscresn));
    end;

    if lbstnrlo ne . then lbscnrlo=strip(put(lbstnrlo*convfact, 8.2));
    if lbstnrhi ne . then lbscnrhi=strip(put(lbstnrhi*convfact, 8.2));
  end;
run;

對以上代碼做幾點(diǎn)說明。單位轉(zhuǎn)換是Standard Units向Conventional Units的轉(zhuǎn)換;不同公司收集的變量名稱不同是很常見的,lbststcd是這個(gè)項(xiàng)目中TESTCD的值,lbscresu保存Conventional Units;在VLM_SPEC中,lborresu保存Conventional Units;在系數(shù)數(shù)據(jù)集中,sasname保存TESTCD值, convfact保存具體的系數(shù)值,convunit保存轉(zhuǎn)換后的Conventional Units;除了換算分析值,對應(yīng)的參考值區(qū)間范圍也要進(jìn)行換算。

關(guān)于保留不一致變量的信息,以便后續(xù)程序條件判斷的代碼,使用了Quote函數(shù),具體介紹可以參考這篇文章,SAS編程:Quote函數(shù)的應(yīng)用。

第2個(gè)關(guān)鍵點(diǎn),生成具體的Paramcd記錄。這個(gè)Paramcd因分析值的類型總共分為3類,分別是標(biāo)準(zhǔn)單位數(shù)值型,傳統(tǒng)單位數(shù)值型以及字符型。編程的思路是,對3類分析值分別處理,生成對應(yīng)的Paramcd。分類信息,一般保存在Adam_VLM_SPEC中。

可以參考以下代碼:

*Get LBTESTCD for conventional unit records, standard unit records and character records;
proc sql noprint;
  *Conventional unit;
  select distinct quote(strip(lbststcd)) into : con_lst separated by ", "
    from adam_vlm_spec
    where domain = "ADLB" and strip(wherevalue)=stirp(lbststcd)||"C" and variable_name="AVAL";
    
  *Standard unit;
  select distinct quote(strip(lbststcd))  into : si_lst separated by ", "
    from adam_vlm_spec
    where domain="ADLB" and strip(wherevalue)=stirp(lbststcd) and variable_name="AVAL";

  *Character;
  select distinct quote(strip(lbststcd))  into : si_lst separated by ", "
    from adam_vlm_spec
    where domain="ADLB" and strip(wherevalue)=stirp(lbststcd) and variable_name="AVALC";
quit;

%put con_lst = &con_lst;
%put si_lst = &si_lst;
%put char_lst = &char_lst;

*Derive Paramcd;
data adlb4;
  set adlb3;
  length paramcd $8.;

  *Conventional Unit;
  if lbscresc ne "" and lbststcd in (&con_lst) then do;
    paramcd = stirp(lbststcd)||"C";
    aval = input(compress(lbscresc,'<>'), best.);
    anrlo = input(lbscnrlo, best.);
    anrhi = input(lbscnrhi, best.);
    output;
  end;

  *Standard Unit;
  if lbstresc ne "" and lbststcd in (&si_lst) then do;
    paramcd = stirp(lbststcd);
    aval = input(compress(lbstresc,'<>'), best.);
    anrlo = input(lbscnrlo, best.);
    anrhi = input(lbscnrhi, best.);
    output;
  end;

   *Character result;
   if lbstresc ne "" and lbststcd in (&char_lst.) then do;
      paramcd = lbststcd;
      avalc = strip(lbstresc);
      output;
    end;
run;

對代碼做一些說明。在adam_vlm_spec中,變量variable_name有兩個(gè)值,AVAL,AVALC,前者表示數(shù)值型分析值,后者表示字符型分析值。對于收集的實(shí)驗(yàn)室檢查的縮寫LBSTSTCD,如果對應(yīng)的是傳統(tǒng)單位的分析值,paramcd = lbststcd; 如果是標(biāo)準(zhǔn)單位的分析值,paramcd = lbststcd||"C"。在這個(gè)項(xiàng)目中,如果有一些實(shí)驗(yàn)室指標(biāo)收集的內(nèi)容是包含>、<符號的,AVAL會直接去掉符號,保留數(shù)值(aval = input(compress(lbscresc,'<>'), best.);)。

以上就是ADLB中Standard Units和Conventional Units的編程處理。

若有疑問,歡迎評論區(qū)交流!

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容