【问题标题】:SAS - Find value in a column and display that value in excel exportSAS - 在列中查找值并在 Excel 导出中显示该值
【发布时间】:2011-12-03 04:23:33
【问题描述】:

我基本上是在尝试这样做:

我有一个在数据集上运行的频率查询,它将在 excel 中输出结果。

我还想在输出中添加一列,其中的值将基于特定单元格或特定列中列出的内容。

我该怎么做呢? (*非常新的 sas 用户)

【问题讨论】:

  • 你能举个例子或多说一点你想做的事吗?

标签: sas


【解决方案1】:

在没有听到更多信息的情况下,我假设您尝试做的是保存 proc freq 的输出,然后使用数据步骤进一步操作它。

这个简单的例子:

data beer;
  length firstname favbrand $20.;
  input firstname $
        favbrand  $;
  datalines;
John bud
Steve dogfishhead
Jason coors
Anna anchorsteam
Bob bud
Dan bud
;
run;

proc freq data=beer;
  table favbrand / out=freqout;
run;

data beerstat(keep=favbrand status);
  set freqout;
  * create a new column called "status" based on the count column ;
  if (count >=2) then status="popular";
  else status = "hipster";
run;

* instead of proc print you can send your output to excel with proc export ;
proc print data=beerstat;
run;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-13
    相关资源
    最近更新 更多