楼主: 邓贵大
4673 6

判断一个FORMAT是否为PICTURE FORMAT [推广有奖]

  • 0关注
  • 18粉丝

博士生

59%

还不是VIP/贵宾

-

威望
0
论坛币
88 个
通用积分
2.1142
学术水平
182 点
热心指数
178 点
信用等级
166 点
经验
9462 点
帖子
296
精华
0
在线时间
335 小时
注册时间
2009-6-17
最后登录
2014-9-20

楼主
邓贵大 发表于 2009-6-19 10:04:19 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
给一个NUMERICAL FORMAT的名字,如何判断它是否为PICTURE FORMAT?比如下面定义的cfmt。
  1. proc format;
  2.     value afmt
  3.     low-<0 = "na"
  4.     0-1 = [pvalue4.]
  5.     >1-10 = "low"
  6.     >10-30 = "stage 1"
  7.     >30-60 = "stage 2"
  8.     >60-120 = "stage 3"
  9.     >120-high = "haha"
  10.     ;
  11.     value bfmt
  12.     0 = "False"
  13.     1 = "True"
  14.     ;
  15.     value cfmt
  16.     0,1=[bfmt5.]
  17.     90-high="impossible"
  18.     low-<0="missing"
  19.     other = [afmt6.]
  20.     ;
复制代码


无论从dictionary.formats或sashelp.vformat都看不出来,而用PROC FORMAT CNTLOUT=导出的数据集里也只能发现它嵌套了别的FORMAT(s)。
  1. proc sql;
  2.     select * from dictionary.formats where fmtname="CFMT" and fmttype="F";
  3. proc format cntlout = a;
  4.     select cfmt;
  5. quit;
复制代码


我能想到的做法是逐层找。谁有更简单的办法的话,我给他/她报销到我们巴东一游!
  1. %macro is_picture_format(fmtname=, tmpdsn=);
  2. %local fmtlib i picture_formats nested_formats;
  3. %let nested_formats = 0;
  4. %let fmtlib = ;
  5. proc sql noprint;
  6.     select cats(libname, '.', memname) into :fmtlib from dictionary.formats
  7.         where libname NE '' and fmtname eq upcase("&fmtname") and fmttype eq 'F';
  8. quit;
  9. %if &fmtlib eq %str() %then %do;
  10.     %let picture_format=1;
  11.     %goto exit;
  12. %end;
  13. %else %do;
  14.     proc format CNTLOUT=&tmpdsn(KEEP=label type hlo) library=&fmtlib;
  15.         select &fmtname;
  16.     run;
  17.     proc sql noprint;
  18.         select cats(count(*)) into :picture_formats from xxx
  19.             where type = 'P';
  20.     quit;
  21.     %if &picture_formats>0 %then %do;
  22.         %let picture_format = 1;
  23.         %goto exit;
  24.     %end;
  25.     %else %do;
  26.         %local nested_formats;
  27.         proc sql noprint;
  28.             select cats(count(*)) into :nested_formats from &tmpdsn
  29.                 where hlo like '%F%';
  30.             %do i = 1 %to &nested_formats;
  31.                 %local fmtname&i;
  32.             %end;
  33.             %if &nested_formats>0 %then %do;
  34.                 %let nested_format = 1;
  35.                 select substr(label, 1, findc(label, '.1234567890', -32767, 'iv'))
  36.                     into :fmtname1-:fmtname&nested_formats from &tmpdsn
  37.                     where hlo like '%F%';
  38.             %end;
  39.         quit;
  40.         %do i=1 %to &nested_formats;
  41.             %is_picture_format(fmtname=&&fmtname&i);
  42.             %if &picture_format>0 %then %goto exit;
  43.         %end;
  44.     %end;    %*end of not (if &picture_formats>0);
  45. %end;    %*end of not (if &fmtlib = );
  46. %exit:
  47. %mend is_picture_format;

  48. %let picture_format=0;
  49. %is_picture_format(fmtname=cfmt, tmpdsn=giglo);
  50. %put picture_format=&picture_format;
复制代码
二维码

扫码加我 拉你入群

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

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

关键词:Picture format FORMA form RMA 判断 format Picture

Be still, my soul: the hour is hastening on
When we shall be forever with the Lord.
When disappointment, grief and fear are gone,
Sorrow forgot, love's purest joys restored.

沙发
andy520 发表于 2009-6-19 12:46:06
我不知道你为什么要判断其是否是picture format,你可以参考一些下面的picture format知识,也许对你有帮助.
format.presentation_32.pdf (867.34 KB, 需要: 2 个论坛币)

藤椅
邓贵大 发表于 2009-6-20 21:43:03
2# andy520
因为PICTURE FORMAT或者嵌套的FORMAT在PROC MEANS中是不能PRELOAD的,也就是说在CNTLOUT导出的数据集中TYPE字段不能有P,HLO字段不能含F,这样的判断只要做一层足矣,所以不才就想到如果仅仅要判断一个FORMAT是否为PICTURE FORMAT怎么办呢?
感谢你参与回复,但是凭你这样的答案即使到了野三关,我也不会给你报销洗脚或者洗头之类的娱乐费用的。
Be still, my soul: the hour is hastening on
When we shall be forever with the Lord.
When disappointment, grief and fear are gone,
Sorrow forgot, love's purest joys restored.

板凳
林嘉祥 发表于 2009-6-21 09:12:38
现在年轻人的经济意识真强,免费的东西也拿来卖!
http://www.sierrainformation.com ... presentation_32.pdf
平生无大志,唯吃饱ZB,喂饱JB耳!

报纸
nernernini 发表于 2009-6-23 03:15:15
thanks for sharing.

地板
nernernini 发表于 2009-6-23 03:16:02
thanks for sharing. learning.

7
崩溃 发表于 2011-11-17 10:56:27
林嘉祥 发表于 2009-6-21 09:12
现在年轻人的经济意识真强,免费的东西也拿来卖!
http://www.sierrainformation.com/presentationPDF/pre ...
可以理解,还不是因为要挣钱买收费的东东,呵呵

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-24 19:01