楼主: fyp198744
1528 5

去掉括号内VDE单位和尾巴! [推广有奖]

  • 0关注
  • 1粉丝

讲师

2%

还不是VIP/贵宾

-

威望
0
论坛币
135 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
5181 点
帖子
257
精华
0
在线时间
258 小时
注册时间
2016-5-23
最后登录
2019-9-30

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
原始数据是
Alanine  Aminotransferase (IU/L) - CN
Alanine Aminotransferase (U/L) - SI
Albumin (g/L) - SI
Albumin (g/dL) - CN
Alkaline Phosphatase (IU/L) - CN
Alkaline Phosphatase (U/L) - SI
Anisocytes - OTHER
Anti-Smooth Muscle Antibody (ASMA) - OTHER
Antinuclear Antibodies - OTHER
Aspartate Aminotransferase (IU/L) - CN
Aspartate Aminotransferase (U/L) - SI
Basophils (10^3/uL) - CN
Basophils (10^9/L) - SI
Bicarbonate (mEq/L) - CN
Bicarbonate (mmol/L) - SI
Bilirubin (mg/dL) - CN
Bilirubin (umol/L) - SI
Bilirubin - OTHER
Blood Urea Nitrogen (mg/dL) - CN
Blood Urea Nitrogen (mmol/L) - SI
Calcium (mg/dL) - CN
Calcium (mmol/L) - SI
Chloride (mEq/L) - CN
Chloride (mmol/L) - SI
Cholesterol (mg/dL) - CN
Cholesterol (mmol/L) - SI
Choriogonadotropin Beta - OTHER
Clarity - OTHER
Color - OTHER
Creatine Kinase (IU/L) - CN
Creatine Kinase (U/L) - SI
Creatinine (mg/dL) - CN
Creatinine (umol/L) - SI
Direct Bilirubin (mg/dL) - CN
Direct Bilirubin (umol/L) - SI
Elliptocytes - OTHER
Eosinophils (10^3/uL) - CN
Eosinophils (10^9/L) - SI
Ery. Mean Corpuscular HGB Concentration (%) - CN
Ery. Mean Corpuscular HGB Concentration (mmol/L) - SI
Ery. Mean Corpuscular Hemoglobin (fmol) - SI
Ery. Mean Corpuscular Hemoglobin (pg) - CN
Ery. Mean Corpuscular Volume (fL) - CN
Ery. Mean Corpuscular Volume (fL) - SI
Erythrocyte Cell Morphology - OTHER
Erythrocytes (10^12/L) - SI
Erythrocytes (10^6/uL) - CN
Estimated GFR (mL/min/1.73 m^2) based on CG method - OTHER
Estimated GFR (mL/min/1.73 m^2) based on CKD-EPI method - OTHER
Estimated GFR (mL/min/1.73 m^2) based on MDRD method - OTHER
Gamma Glutamyl Transferase (IU/L) - CN
Gamma Glutamyl Transferase (U/L) - SI
Glucose (mg/dL) - CN
Glucose (mmol/L) - SI
Glucose - OTHER
Haptoglobin (g/L) - SI
Haptoglobin (mg/dL) - CN
Hematocrit (%) - CN
Hematocrit (fraction of 1) - SI
Hemoglobin (g/dL) - CN
Hemoglobin (mmol/L) - SI
Hemoglobin A1C (%) - CN
Hemoglobin A1C (mmol/mol) - SI
Hepatitis A Virus Antibody - OTHER
Hepatitis A Virus Antibody IgM - OTHER
Hepatitis B Virus Core Antibody - OTHER
Hepatitis B Virus Surface Antibody - OTHER
Hepatitis B Virus Surface Antigen - OTHER
Hepatitis C Virus Antibody - OTHER
Hepatitis C Virus RNA (IU/mL) - CN
Hepatitis C Virus RNA (IU/mL) - SI
Hepatitis E PCR - OTHER
Hepatitis E Virus IgM Antibody - OTHER
Hepatitis E, IGG - OTHER
High-density Lipoprotein (HDL) Cholesterol (mg/dL) - CN
High-density Lipoprotein (HDL) Cholesterol (mmol/L) - SI
Hypochromia - OTHER
Insulin (pmol/L) - SI
Insulin (uU/mL) - CN
Ketones - OTHER
Lactate Dehydrogenase (IU/L) - CN
Lactate Dehydrogenase (U/L) - SI
Leukocyte Esterase - OTHER
Leukocytes (10^3/uL) - CN
Leukocytes (10^9/L) - SI
Log(Triglycerides) - CN
Log(Triglycerides) - SI
Low-density Lipoprotein (LDL) Cholesterol (Combined) (mg/dL) -  CN
Low-density Lipoprotein (LDL) Cholesterol (Combined) (mmol/L) -  SI
Low-density Lipoprotein (LDL) Cholesterol (Direct) (mg/dL) - CN
Low-density Lipoprotein (LDL) Cholesterol (Direct) (mmol/L) - SI
Low-density Lipoprotein (LDL) Cholesterol (mg/dL) - CN
Low-density Lipoprotein (LDL) Cholesterol (mmol/L) - SI
Lymphocytes (10^3/uL) - CN
Lymphocytes (10^9/L) - SI
Lymphocytes Atypical (10^9/L) - CN
Lymphocytes Atypical (10^9/L) - SI
Macrocytes - OTHER
Magnesium (mg/dL) - CN
Magnesium (mmol/L) - SI
Microcytes - OTHER
Monocytes (10^3/uL) - CN
Monocytes (10^9/L) - SI
Myelocytes (10^9/L) - CN
Myelocytes (10^9/L) - SI
Neutrophilic Metamyelocytes (10^3/uL) - CN
Neutrophilic Metamyelocytes (10^9/L) - SI
Neutrophils, Segmented (10^3/uL) - CN
Neutrophils, Segmented (10^9/L) - SI
Nitrite - OTHER
Occult Blood - OTHER
Phosphate (mg/dL) - CN
Phosphate (mmol/L) - SI
Platelets (10^3/uL) - CN
Platelets (10^9/L) - SI
Poikilocytes - OTHER
Polychromasia - OTHER
Potassium (mEq/L) - CN
Potassium (mmol/L) - SI
Protein (g/L) - SI
Protein (g/dL) - CN
Protein - OTHER
Prothrombin Intl. Normalized Ratio (RATIO) - CN
Prothrombin Intl. Normalized Ratio (RATIO) - SI
Prothrombin Time (sec) - CN
Prothrombin Time (sec) - SI
Sodium (mEq/L) - CN
Sodium (mmol/L) - SI
Specific Gravity - CN
Specific Gravity - SI
Target Cells - OTHER
Triglycerides (mg/dL) - CN
Triglycerides (mmol/L) - SI
Urate (mg/dL) - CN
Urate (umol/L) - SI
Urobilinogen - OTHER
pH - CN
pH - SI
最后希望把尾巴-cn-si-other和单位连同括号一起去掉变成
Alanine  Aminotransferase
Alanine Aminotransferase
Albumin
Albumin
Alkaline Phosphatase
Alkaline Phosphatase
Anisocytes
Anti-Smooth Muscle Antibody
Antinuclear Antibodies
Aspartate Aminotransferase
Aspartate Aminotransferase
Basophils
Basophils
Bicarbonate
Bicarbonate
Bilirubin
Bilirubin
Bilirubin
Blood Urea Nitrogen
Blood Urea Nitrogen
Calcium
Calcium
Chloride
Chloride
Cholesterol
Cholesterol
Choriogonadotropin Beta
Clarity
Color
Creatine Kinase
Creatine Kinase
Creatinine
Creatinine
Direct Bilirubin
Direct Bilirubin
Elliptocytes
Eosinophils
Eosinophils
Ery. Mean Corpuscular HGB Concentration
Ery. Mean Corpuscular HGB Concentration
Ery. Mean Corpuscular Hemoglobin
Ery. Mean Corpuscular Hemoglobin
Ery. Mean Corpuscular Volume
Ery. Mean Corpuscular Volume
Erythrocyte Cell Morphology
Erythrocytes
Erythrocytes
Estimated GFR  based on CG  method
Estimated GFR based on CKD-EPI method
Estimated GFR  based on  MDRD method
Gamma Glutamyl Transferase
Gamma Glutamyl Transferase
Glucose
Glucose
Glucose
Haptoglobin
Haptoglobin
Hematocrit
Hematocrit
Hemoglobin
Hemoglobin
Hemoglobin A1C
Hemoglobin A1C
Hepatitis A Virus Antibody
Hepatitis A Virus Antibody IgM
Hepatitis B Virus Core Antibody
Hepatitis B Virus Surface Antibody
Hepatitis B Virus Surface Antigen
Hepatitis C Virus Antibody
Hepatitis C Virus RNA
Hepatitis C Virus RNA
Hepatitis E PCR
Hepatitis E Virus IgM Antibody
Hepatitis E, IGG
High-density Lipoprotein   Cholesterol
High-density Lipoprotein   Cholesterol
Hypochromia
Insulin
Insulin
Ketones
Lactate Dehydrogenase
Lactate Dehydrogenase
Leukocyte Esterase
Leukocytes
Leukocytes
Log
Log
Low-density Lipoprotein   Cholesterol
Low-density Lipoprotein   Cholesterol
Low-density Lipoprotein   Cholesterol
Low-density Lipoprotein   Cholesterol
Low-density Lipoprotein   Cholesterol
Low-density Lipoprotein   Cholesterol
Lymphocytes
Lymphocytes
Lymphocytes Atypical
Lymphocytes Atypical
Macrocytes
Magnesium
Magnesium
Microcytes
Monocytes
Monocytes
Myelocytes
Myelocytes
Neutrophilic Metamyelocytes
Neutrophilic Metamyelocytes
Neutrophils, Segmented
Neutrophils, Segmented
Nitrite
Occult Blood
Phosphate
Phosphate
Platelets
Platelets
Poikilocytes
Polychromasia
Potassium
Potassium
Protein
Protein
Protein
Prothrombin Intl. Normalized Ratio
Prothrombin Intl. Normalized Ratio
Prothrombin Time
Prothrombin Time
Sodium
Sodium
Specific Gravity
Specific Gravity
Target Cells
Triglycerides
Triglycerides
Urate
Urate
Urobilinogen
pH
pH
这里有几个难点,第一保留的值中也有“-”这个连接符,第二,单位不一定在最后,有的也会在中间!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:morphology estimated segmented transfer estimate

沙发
wwang111 发表于 2016-9-29 12:06:02 |只看作者 |坛友微信交流群
data wanted;
set test;
do while(index(test,'('));
par_l=index(test,'(');
par_r=index(test,')');
test=substr(test,1,par_l-1)||substr(test,par_r+1);
end;
dashpos=find(test,'-',-length(test));
if dashpos ne 0 then test=substr(test,1,dashpos-1);
keep test;
run;

使用道具

藤椅
fyp198744 发表于 2016-9-29 13:35:32 |只看作者 |坛友微信交流群
wwang111 发表于 2016-9-29 12:06
data wanted;
set test;
do while(index(test,'('));
你这里的test既是数据集,又是变量吗?为什么我拿过改了之后运行起来就一直是runing状态?

使用道具

板凳
wwang111 发表于 2016-9-29 18:30:24 |只看作者 |坛友微信交流群
是的,test数据集里的test变量。
如果一直running,我猜测应该是test=substr(test,1,par_l-1)||substr(test,par_r+1);改了,这句等号左右两边的变量名是一样的,要么都是test,要么都是其他,否则,就不会满足do循环结束的条件了,就会一直运行。

使用道具

报纸
fyp198744 发表于 2016-9-30 09:55:33 |只看作者 |坛友微信交流群
wwang111 发表于 2016-9-29 18:30
是的,test数据集里的test变量。
如果一直running,我猜测应该是test=substr(test,1,par_l-1)||substr(tes ...
好的!成功了!
但是
dashpos=find(test,'-',-length(test));
if dashpos ne 0 then test=substr(test,1,dashpos-1);
不太理解,这个find是从哪里作为起始位置,是向前还是向后?

使用道具

地板
wang1839 在职认证  发表于 2016-9-30 11:11:30 |只看作者 |坛友微信交流群
  1. data a;
  2. length test $100 ;
  3. input test &;
  4. cards;
  5. Alanine Aminotransferase (IU/L) - CN
  6. Alanine Aminotransferase (U/L) - SI
  7. Albumin (g/L) - SI
  8. Albumin (g/dL) - CN
  9. Alkaline Phosphatase (IU/L) - CN
  10. Alkaline Phosphatase (U/L) - SI
  11. Anisocytes - OTHER
  12. Anti-Smooth Muscle Antibody (ASMA) - OTHER
  13. Antinuclear Antibodies - OTHER
  14. Aspartate Aminotransferase (IU/L) - CN
  15. Aspartate Aminotransferase (U/L) - SI
  16. Basophils (10^3/uL) - CN
  17. Basophils (10^9/L) - SI
  18. Bicarbonate (mEq/L) - CN
  19. Bicarbonate (mmol/L) - SI
  20. Bilirubin (mg/dL) - CN
  21. Bilirubin (umol/L) - SI
  22. Bilirubin - OTHER
  23. Blood Urea Nitrogen (mg/dL) - CN
  24. Blood Urea Nitrogen (mmol/L) - SI
  25. Calcium (mg/dL) - CN
  26. Calcium (mmol/L) - SI
  27. Chloride (mEq/L) - CN
  28. Chloride (mmol/L) - SI
  29. Cholesterol (mg/dL) - CN
  30. Cholesterol (mmol/L) - SI
  31. Choriogonadotropin Beta - OTHER
  32. Clarity - OTHER
  33. Color - OTHER
  34. Creatine Kinase (IU/L) - CN
  35. Creatine Kinase (U/L) - SI
  36. Creatinine (mg/dL) - CN
  37. Creatinine (umol/L) - SI
  38. Direct Bilirubin (mg/dL) - CN
  39. Direct Bilirubin (umol/L) - SI
  40. Elliptocytes - OTHER
  41. Eosinophils (10^3/uL) - CN
  42. Eosinophils (10^9/L) - SI
  43. Ery. Mean Corpuscular HGB Concentration (%) - CN
  44. Ery. Mean Corpuscular HGB Concentration (mmol/L) - SI
  45. Ery. Mean Corpuscular Hemoglobin (fmol) - SI
  46. Ery. Mean Corpuscular Hemoglobin (pg) - CN
  47. Ery. Mean Corpuscular Volume (fL) - CN
  48. Ery. Mean Corpuscular Volume (fL) - SI
  49. Erythrocyte Cell Morphology - OTHER
  50. Erythrocytes (10^12/L) - SI
  51. Erythrocytes (10^6/uL) - CN
  52. Estimated GFR (mL/min/1.73 m^2) based on CG method - OTHER
  53. Estimated GFR (mL/min/1.73 m^2) based on CKD-EPI method - OTHER
  54. Estimated GFR (mL/min/1.73 m^2) based on MDRD method - OTHER
  55. Gamma Glutamyl Transferase (IU/L) - CN
  56. Gamma Glutamyl Transferase (U/L) - SI
  57. Glucose (mg/dL) - CN
  58. Glucose (mmol/L) - SI
  59. Glucose - OTHER
  60. Haptoglobin (g/L) - SI
  61. Haptoglobin (mg/dL) - CN
  62. Hematocrit (%) - CN
  63. Hematocrit (fraction of 1) - SI
  64. Hemoglobin (g/dL) - CN
  65. Hemoglobin (mmol/L) - SI
  66. Hemoglobin A1C (%) - CN
  67. Hemoglobin A1C (mmol/mol) - SI
  68. Hepatitis A Virus Antibody - OTHER
  69. Hepatitis A Virus Antibody IgM - OTHER
  70. Hepatitis B Virus Core Antibody - OTHER
  71. Hepatitis B Virus Surface Antibody - OTHER
  72. Hepatitis B Virus Surface Antigen - OTHER
  73. Hepatitis C Virus Antibody - OTHER
  74. Hepatitis C Virus RNA (IU/mL) - CN
  75. Hepatitis C Virus RNA (IU/mL) - SI
  76. Hepatitis E PCR - OTHER
  77. Hepatitis E Virus IgM Antibody - OTHER
  78. Hepatitis E, IGG - OTHER
  79. High-density Lipoprotein (HDL) Cholesterol (mg/dL) - CN
  80. High-density Lipoprotein (HDL) Cholesterol (mmol/L) - SI
  81. Hypochromia - OTHER
  82. Insulin (pmol/L) - SI
  83. Insulin (uU/mL) - CN
  84. Ketones - OTHER
  85. Lactate Dehydrogenase (IU/L) - CN
  86. Lactate Dehydrogenase (U/L) - SI
  87. Leukocyte Esterase - OTHER
  88. Leukocytes (10^3/uL) - CN
  89. Leukocytes (10^9/L) - SI
  90. Log(Triglycerides) - CN
  91. Log(Triglycerides) - SI
  92. Low-density Lipoprotein (LDL) Cholesterol (Combined) (mg/dL) -  CN
  93. Low-density Lipoprotein (LDL) Cholesterol (Combined) (mmol/L) -  SI
  94. Low-density Lipoprotein (LDL) Cholesterol (Direct) (mg/dL) - CN
  95. Low-density Lipoprotein (LDL) Cholesterol (Direct) (mmol/L) - SI
  96. Low-density Lipoprotein (LDL) Cholesterol (mg/dL) - CN
  97. Low-density Lipoprotein (LDL) Cholesterol (mmol/L) - SI
  98. Lymphocytes (10^3/uL) - CN
  99. Lymphocytes (10^9/L) - SI
  100. Lymphocytes Atypical (10^9/L) - CN
  101. Lymphocytes Atypical (10^9/L) - SI
  102. Macrocytes - OTHER
  103. Magnesium (mg/dL) - CN
  104. Magnesium (mmol/L) - SI
  105. Microcytes - OTHER
  106. Monocytes (10^3/uL) - CN
  107. Monocytes (10^9/L) - SI
  108. Myelocytes (10^9/L) - CN
  109. Myelocytes (10^9/L) - SI
  110. Neutrophilic Metamyelocytes (10^3/uL) - CN
  111. Neutrophilic Metamyelocytes (10^9/L) - SI
  112. Neutrophils, Segmented (10^3/uL) - CN
  113. Neutrophils, Segmented (10^9/L) - SI
  114. Nitrite - OTHER
  115. Occult Blood - OTHER
  116. Phosphate (mg/dL) - CN
  117. Phosphate (mmol/L) - SI
  118. Platelets (10^3/uL) - CN
  119. Platelets (10^9/L) - SI
  120. Poikilocytes - OTHER
  121. Polychromasia - OTHER
  122. Potassium (mEq/L) - CN
  123. Potassium (mmol/L) - SI
  124. Protein (g/L) - SI
  125. Protein (g/dL) - CN
  126. Protein - OTHER
  127. Prothrombin Intl. Normalized Ratio (RATIO) - CN
  128. Prothrombin Intl. Normalized Ratio (RATIO) - SI
  129. Prothrombin Time (sec) - CN
  130. Prothrombin Time (sec) - SI
  131. Sodium (mEq/L) - CN
  132. Sodium (mmol/L) - SI
  133. Specific Gravity - CN
  134. Specific Gravity - SI
  135. Target Cells - OTHER
  136. Triglycerides (mg/dL) - CN
  137. Triglycerides (mmol/L) - SI
  138. Urate (mg/dL) - CN
  139. Urate (umol/L) - SI
  140. Urobilinogen - OTHER
  141. pH - CN
  142. pH - SI
  143. ;
  144. run;


  145. data cdtest;
  146.         set a;
  147.         num=count(test,'-');
  148.         units=scan(test,num+1,'-');
  149.         testcd=substr(test,1,length(test)-length(units)-2);
  150.         numl=count(testcd,'(');
  151.         if index(testcd,'(') then do;
  152.         posl=index(testcd,'(');
  153.         posr=index(testcd,')');
  154.         test1=substr(testcd,1,posl-1)||substr(testcd,posr+1);
  155.         end;
  156.         else test1=testcd;
  157.         keep test1;
  158. run;
复制代码
A man who is frustrated will never stand up.

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-30 19:06