- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想知道是否有可能在 sas 中使用 proc sql 有效地从宽转换为长。
我知道 proc transpose 比我在下面建议的方法要快得多。但我的目标之一是避免存储转置表。
例如,让我们说,我有 table1 作为
Id| A| B| C| D
_____________________
1| 100|3500|6900| 10300
2| 200| 250| 300| 350
3| 150| 32| 400| 204
4| 200| 800|1400| 2000
id|col1| col2|
______________
1| A| 100|
1| B| 3500|
1| C| 6900|
1| D| 10300|
2| A| 200|
2| B| 250|
2| C| 300|
2| D| 350|
3| A| 150|
3| B| 32|
3| C| 400|
3| D| 204|
4| A| 200|
4| B| 800|
4| C| 1400|
4| D| 2000|
最佳答案
如果您在 SAS
, 使用 PROC TRANSPOSE
对于这个选项。在 PROC SQL;
中没有特别好的方法可以做到这一点。虽然很多 SQL
变体有自己的数据透视方式,SAS
有 PROC TRANSPOSE
并希望您使用它。
SAS 数据步骤也非常有效地执行此操作,甚至可能比 PROC TRANSPOSE
更好.这是一个示例,包括创建注释中所述的 View 。
data want/view=want;
set have;
array vars a b c d; *array of your columns to transpose;
do _t = 1 to dim(vars); *iterate over the array (dim(vars) gives # of elements);
if not missing(vars[_t]) then do; *if the current array element's value is nonmissing;
col1=vname(vars[_t]); *then store the variable name from that array element in a var;
col2=vars[_t]; *and store the value from that array element in another var;
output; *and finally output that as a new row;
end;
end;
drop a b c d _t; *Drop the old vars (cols) and the dummy variable _t;
run;
关于sql - 使用 proc sql 高效转置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18320035/
在经历了DDOS攻击后,不知何故/proc/kcore非常巨大,我使用一个小的php类来检查当前的磁盘空间,以及已经使用了多少。 它显示以下内容: Total Disk Space: 39.2 GB
所以我从 ruby 移植了一个工具,可以在对象上定义回调 block ,我希望在设置回调的情况下调用它。所以基本上是这样的。 def set_block(&block) @new_kid_on
我定义了两个脚本:第一个脚本调用第二个脚本中的 proc。第二个脚本定义了一个命名空间 fooSpace , 定义了一个变量 fooValue内fooSpace , 并定义了一个过程 myProc内f
使用一个 proc 时,我的脚本工作正常(检索 sftp 提示)。但是当我尝试在 proc 中使用 proc 时,脚本卡住了,我不知道为什么。 请不要重构代码,这不是重点,我需要了解这里的问题。 工作
我想知道是否有一种方法可以识别某些proc文件中用于DMA映射的内存,例如mtrr和iomem,或者通过lspic -vv . 在我的/proc/mtrr中,只有一个无法缓存区域,它似乎几乎指向3.5
我有 2 个过程,它们一个接一个地调用。第一个过程使用 diff 功能并创建 file.txt。压缩文件后的过程。问题是当我运行脚本时,file.txt 是空的。当我注释掉压缩过程时,文件中打印了差异
我曾经认为 /proc/self 和 /proc/$$ 在 bash 终端中是一样的,但现在我发现它们是不同的。 我知道$$是当前进程的pid,/proc/self是当前运行的进程,应该是bash终端
在下面的程序中,我想在第 2 个过程中捕获数据包,而 ping 在第 1 个过程中运行。现在,如果我执行这个程序,proc 正在运行 ping 并退出它。有解决此问题的想法吗? 我的 TCL 代码:
在 proc 中,您可以获得 proc 名称(无需对其进行硬编码)吗?例如 proc my_proc { some_arg } { puts "entering proc [some way
我有一个自定义的 A10 存储库,我试图在其中创建一个能够读取 /proc/[pid]/some-file 的应用程序文件,例如stat和 status ,有点像 ps做。 看完这篇 answer很明
我是 TCL 的新人。我通过 Windows Vista 下的 DOS 窗口“tclsh85 FOD/Scripts/program1.tcl”执行 TCL 代码。 program1.tcl 包含“s
我想查看每个进程的精确内存量用作匿名页,因为匿名内存不能调出,因此精确跟踪此使用情况非常重要。 获取匿名页面总数的一种方法是读取/proc/meminfo AnonPages。 另一种方法是将 sma
在 Ruby 中,Proc.new { 'waffles' } 和 proc { 'waffles' } 之间有什么区别吗?我发现很少有人提到第二种语法。 使用 irb 进行测试,我没有发现任何明显的
我正在寻找有关Linux系统上/proc/net/nf_conntrack和/或/proc/net/ip_contrack文件内容的详细文档。 是的,我知道,有许多实用程序可以用人类可读的格式向我显示
而不是执行多个单独的 PROC FREQ一个非常大的数据集上的程序,我想通过执行单个 PROC FREQ 来提高效率与多个 TABLE声明。我们的 QA 流程需要表格标题,这很简单,只需一个 TABL
我想在 /proc/driver 下创建一个文件目录。我想使用像 proc_root_driver 这样的宏(或提供的其他东西)而不是明确使用“驱动程序/模块名称”。我用 create_proc_en
在 SQL Server 2005 中,我希望名为 LimitedUser 的用户只能运行一个过程: GRANT EXEC ON [usp_RunETL] TO [LimitedUser] 但是,该
考虑到以下两个过程: proc firstOne(): void = echo "X" proc secondOne(): void = echo "X" discard 它们
我想使用 PROC TABULATE 复制 PROC MEANS 的输出。原因是我希望将利润百分比(或利润率)作为 PROC MEANS 输出中的变量之一,但希望抑制一个或多个统计数据的计算,即会有一
我的目标是使数据适合具有正支持的任何分布。 (威 bool (2p)、 Gamma (2p)、帕累托 (2p)、对数正态 (2p)、指数 (1P))。第一次尝试,我使用了 proc univariat
我是一名优秀的程序员,十分优秀!