z*********i 发帖数: 146 | 1 我想输出一个表格
格式如下:
######## VAR1 VAR2 VAR3
######## FREQ % FREQ % FREQ %
FEMALE# 940 49.8 141,84 52.5 57,308 42.2
MALE### 947 50.2 12,844 47.5 78,599 57.8
TOTAL## 1,866 100 27,027 100 135,906 100
VAR1 VAR2 是CHAR , VAR3 是NUM |
s*****9 发帖数: 285 | 2 倒进去proc import用xls
就不要注意太多delimiter,missover,这些细节 |
z*********i 发帖数: 146 | 3 感谢感谢
能用proc 直接输出么?
【在 s*****9 的大作中提到】 : 倒进去proc import用xls : 就不要注意太多delimiter,missover,这些细节
|
s*****9 发帖数: 285 | 4 可以的,proc export,假如你是txt文件,每个var之间加个tab. |
z*********i 发帖数: 146 | 5 我直接是SAS格式的文件
呵呵 我没说清楚 是想用PROC tabulate之类的 直接输出表格
数据 20G左右
【在 s*****9 的大作中提到】 : 可以的,proc export,假如你是txt文件,每个var之间加个tab.
|
s*****9 发帖数: 285 | 6 嗯, proc export,不清楚格式google下Proc export ucla |
z*********i 发帖数: 146 | 7 不好意思 我太不常用import了 先学习下 XLS是 EXCEL?
【在 s*****9 的大作中提到】 : 倒进去proc import用xls : 就不要注意太多delimiter,missover,这些细节
|
s*****9 发帖数: 285 | |
g****8 发帖数: 2828 | 9 你原来的数据是什么样子的?
【在 z*********i 的大作中提到】 : 我想输出一个表格 : 格式如下: : ######## VAR1 VAR2 VAR3 : ######## FREQ % FREQ % FREQ % : FEMALE# 940 49.8 141,84 52.5 57,308 42.2 : MALE### 947 50.2 12,844 47.5 78,599 57.8 : TOTAL## 1,866 100 27,027 100 135,906 100 : VAR1 VAR2 是CHAR , VAR3 是NUM
|
z*********i 发帖数: 146 | 10 SAS格式的数据 20G左右 呵呵 还能怎么描述?提示一下
【在 g****8 的大作中提到】 : 你原来的数据是什么样子的?
|
|
|
g****8 发帖数: 2828 | 11 我是问你都有什么样子的var,你给的那个例子,我怎么觉得不对。
如果是freq的,为什么var1 跟var2的total不一样。
比如说是不是你有var1 var2 var3 gender,对gender做表格?
【在 z*********i 的大作中提到】 : SAS格式的数据 20G左右 呵呵 还能怎么描述?提示一下
|
z*********i 发帖数: 146 | 12 data sample:
RCPT_ULI final_pcn our_doc1 GENDER_USE AGE_10 zone level agegroup
111111110 . . . .
111112090 . M 50.41 1 6
111112151 . . . .
111112231 13 F685640 M 52.34 Ed 1 6
111112330 24 F035580 F 39.62 Ca 1 4
111112410 36 B561570 F 73.77 No 6 8
111112820 12 H113470 M 43.16 Ed 1 5
111112900 8 A067880 F 86.58 Ca 6 9
111112320 8 D409830 F 46.57 Ca 5 5
111112400 21 F726700 F 84.46 Ed 5 9
Alphabetic List of Variables and Attributes
# Variable Type Len Format Informat Label
5 AGE_10 Num 8
4 GENDER_USE Char 1
1 ULI Num 8 11. 11. RCPT_ULI
8 agegroup Num 8
2 final_pcn Num 8
7 level Num 3
3 our_doc1 Char 10
6 zone Char 8
我想输出一个表格
格式如下:
######## our_doc final_pcn zone
######## FREQ % FREQ % FREQ %
FEMALE# 940 49.8 141,84 52.5 57,308 42.2
MALE### 947 50.2 12,844 47.5 78,599 57.8
TOTAL## 1,866 100 27,027 100 135,906 100 |
z*********i 发帖数: 146 | 13 10
【在 g****8 的大作中提到】 : 我是问你都有什么样子的var,你给的那个例子,我怎么觉得不对。 : 如果是freq的,为什么var1 跟var2的total不一样。 : 比如说是不是你有var1 var2 var3 gender,对gender做表格?
|
g****8 发帖数: 2828 | 14 I don't think you can generate the tabulate directly.
But I can show you a easy way to get the data you want, and then just
another easy calculation in SAS or EXCEL.
PROC SQL;
CREATE TABLE s1 AS
SELECT Gender_Use,
COUNT( distinct Case WHEN Gender_Use='F' then our_doc end) as our_doc_F,
COUNT( distinct Case WHEN Gender_Use='M' then our_doc end) as our_doc_M,
COUNT( distinct Case WHEN Gender_Use='F' then final_pcn end) as final_pcn_F,
COUNT( distinct Case WHEN Gender_Use='M' then final_pcn end) as final_pcn_M,
COUNT( distinct Case WHEN Gender_Use='F' then zone end) as zone_F,
COUNT( distinct Case WHEN Gender_Use='M' then zone end) as zone_M
FROM sample
GROUP BY Gender_Use
;
QUIT;
【在 z*********i 的大作中提到】 : 10
|
a*****3 发帖数: 601 | 15 我觉得应该可以 - 等我老吃晚饭再说啊
_doc_F,
_doc_M,
final_pcn_F,
final_pcn_M,
【在 g****8 的大作中提到】 : I don't think you can generate the tabulate directly. : But I can show you a easy way to get the data you want, and then just : another easy calculation in SAS or EXCEL. : PROC SQL; : CREATE TABLE s1 AS : SELECT Gender_Use, : COUNT( distinct Case WHEN Gender_Use='F' then our_doc end) as our_doc_F, : COUNT( distinct Case WHEN Gender_Use='M' then our_doc end) as our_doc_M, : COUNT( distinct Case WHEN Gender_Use='F' then final_pcn end) as final_pcn_F, : COUNT( distinct Case WHEN Gender_Use='M' then final_pcn end) as final_pcn_M,
|
g****8 发帖数: 2828 | 16 饭,还没有吃完?
您老说可以,那我也去研究一下。
【在 a*****3 的大作中提到】 : 我觉得应该可以 - 等我老吃晚饭再说啊 : : _doc_F, : _doc_M, : final_pcn_F, : final_pcn_M,
|
d******9 发帖数: 404 | 17 Easy. Both Proc Tabulate and Proc Report can do it.
Let me give u codes tomorrow. |
g****8 发帖数: 2828 | 18 It seems that there is no way to count distinct values in proc tabulate. |
d******9 发帖数: 404 | 19 如果是freq的,为什么var1 跟var2的total不一样。???
Co-ask. It the output really frequency?????????? |
z*********i 发帖数: 146 | 20 我这正郁闷呢 头出差还没回来 把我接任务的过程 描述如下: 头说, 我要出差 两周
后回来 你给我做几个图表出来 格式 说着给我一叠打印材料。 我觉得 图表没问题啊
做呗。 现在状态是 其他的 都做好了 就剩这个表了 楼上各位的问题 我也困惑中 是
missing value造成的??? |
|
|
z*********i 发帖数: 146 | 21 感谢感谢啊
_doc_F,
_doc_M,
final_pcn_F,
final_pcn_M,
【在 g****8 的大作中提到】 : I don't think you can generate the tabulate directly. : But I can show you a easy way to get the data you want, and then just : another easy calculation in SAS or EXCEL. : PROC SQL; : CREATE TABLE s1 AS : SELECT Gender_Use, : COUNT( distinct Case WHEN Gender_Use='F' then our_doc end) as our_doc_F, : COUNT( distinct Case WHEN Gender_Use='M' then our_doc end) as our_doc_M, : COUNT( distinct Case WHEN Gender_Use='F' then final_pcn end) as final_pcn_F, : COUNT( distinct Case WHEN Gender_Use='M' then final_pcn end) as final_pcn_M,
|
a*****3 发帖数: 601 | 22 就是嘛 先把business sense搞懂再说嘛. 否则做出来 对错自己都不知道. |
g****8 发帖数: 2828 | 23 TX, that's reason I said proc tabulate can not do it.
I checked proc report might be, but it is too complicated to use the compute
part. In my opinion, I don't think it is worthy to do that.
【在 d******9 的大作中提到】 : 如果是freq的,为什么var1 跟var2的total不一样。??? : Co-ask. It the output really frequency??????????
|
g****8 发帖数: 2828 | 24 那给我发几个包子吧
【在 z*********i 的大作中提到】 : 感谢感谢啊 : : _doc_F, : _doc_M, : final_pcn_F, : final_pcn_M,
|