楼主: diesel5
1463 4

sas little book 4.22章节report过程步的问题 [推广有奖]

  • 0关注
  • 0粉丝

大专生

5%

还不是VIP/贵宾

-

威望
0
论坛币
0 个
通用积分
0.0000
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
413 点
帖子
22
精华
0
在线时间
63 小时
注册时间
2013-5-14
最后登录
2024-8-16

楼主
diesel5 发表于 2014-2-27 10:26:50 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
data teng.narparks2 ;
infile 'C:\Users\Administrator\codes_sas\Parks.dat';
input name $1-21 type $ region $ museums camping;
run;
proc report nowindows missing headline;
column name type region museums camping facilities note;
define museums / sum ;
define camping / sum ;
define facilities / computed 'camping /and /museums';
compute facilities ;
facilities = museums.sum + camping.sum;
endcomp;
define note / computed ;
compute note / char length = 11;
if camping = 0 then note = 'no camping';   书上写的是camping.sum = 0 ????
endcomp;
title 'addsdf3wrfdefds';
run;

按照书上写的camping.sum= o的话,我最后得到结果note是正常的,但是写成if camping = 0的话,输出结果在note 一行就全变成了 no camping。。想请教下高手,为什么会成这样?在report过程中,是不能利用源数据来进行if逻辑判断呢??

数据是这样的

name

type

region

museums

camping

Dinosaur

NM

West

2

6

Ellis Island

NM

East

1

0

Everglades

NP

East

5

2

Grand Canyon

NP

West

5

3

Great Smoky Mountains

NP

East

3

10

Hawaii Volcanoes

NP

West

2

2

Lava Beds

NM

West

1

1

Statue of Liberty

NM

East

1

0

Theodore Roosevelt

NP

 

2

2

Yellowstone

NP

West

9

11

Yosemite

NP

West

2

13


二维码

扫码加我 拉你入群

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

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

关键词:little Report repor repo Book little report

沙发
irisbird 发表于 2014-3-1 12:32:53
Did you try if camping=2,   what are the results?

藤椅
irisbird 发表于 2014-3-1 13:02:00
TITLE "Conditional LINE statement processing for null lines of output";         
PROC REPORT NOWD DATA=sashelp.class;                                             
   COLUMN  Name Sex Age Height Weight;  
   DEFINE  Name / DISPLAY FORMAT= $8. WIDTH=8 LEFT "Name" ;      
   DEFINE  Sex / DISPLAY FORMAT= $1. WIDTH=7 LEFT "Gender" ;      
   DEFINE  Age / ORDER FORMAT= BEST9. WIDTH=9 RIGHT "Age" ;      
   DEFINE  Height / SUM FORMAT= BEST9. WIDTH=9 RIGHT "Height" ;   
   DEFINE  Weight / SUM FORMAT= BEST9. WIDTH=9 RIGHT "Weight";
   COMPUTE AFTER age;                                                               
      LENGTH text $ 50;                                                               
      IF age=15 THEN DO;                                                               
         text = 'for age=15 only';                                                     
         num=50;                                                                       
      END;                                                                             
      ELSE DO;                                                                        
         text = "";                                                                    
         num=0;                                                                        
      END;                                                                             
      LINE text $VARYING. num ;                                                      
   ENDCOMP;                                                                        
RUN;

板凳
irisbird 发表于 2014-3-1 13:02:48
Compare yours with the above code

报纸
diesel5 发表于 2014-3-1 15:11:40
irisbird 发表于 2014-3-1 12:32
Did you try if camping=2,   what are the results?
thank you for your reply.
I use the 2 for camping, but the result  also didn't satisfied.
I think it is not the value problem, it needs to dig the process of the REPORT procedure .

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-2 20:44