sas - 如何在 SAS EG 中手动输入数据
问题描述
刚开始学习 SAS,正在阅读一本使用以下代码创建表的教科书。
Data travel;
input City $ 1-9 Nights 11 LandCost 13-16 NumberOfEvents 18
EventDescription $ 20-36 TourGuide $ 38-45
BackUpGuide $ 47-54;
datalines;
Rome 3 750 7 4 M, 3 G D’Amico Torres
Paris 8 1680 6 5 M, 1 other Lucas Lucas
London 6 1230 5 3 M, 2 G Wilson Lucas
New York 6 . 8 5 M, 1 G, 2 other Lucas D’Amico
Madrid 3 370 5 3 M, 2 other Torres D’Amico
Amsterdam 4 580 6 3 M, 3 G Vandever
;
Run;
这本书给出了预期的输出:
解决方案
你是如何自己输入数据线的?
如果您使用将制表位设置为 4 的编辑器键入它们,并且在键入数据行期间使用了一些制表符,则这些停止可能导致数据与示例代码不对齐。
如果您复制粘贴,则可能源具有选项卡并且编辑器将选项卡扩展到到达制表位的空格。
无论如何,添加“标尺”注释行可以帮助您了解需要对代码或数据行进行哪些调整。
Data travel;
input City $ 1-9 Nights 11 LandCost 13-16 NumberOfEvents 18
EventDescription $ 20-36 TourGuide $ 38-45
BackUpGuide $ 47-54;
datalines;
Rome 3 750 7 4 M, 3 G D’Amico Torres
Paris 8 1680 6 5 M, 1 other Lucas Lucas
London 6 1230 5 3 M, 2 G Wilson Lucas
New York 6 . 8 5 M, 1 G, 2 other Lucas D’Amico
Madrid 3 370 5 3 M, 2 other Torres D’Amico
Amsterdam 4 580 6 3 M, 3 G Vandever
;
*234567890123456789012345678901234567890123456789012345678901234567890123
* 1 2 3 4 5 6 7
* T T T T T T T T T T T T T T T T T T cursor position after tab hit
;
<NOSTALGIA>
有时我会怀念程序编辑器和COLS等行命令
SAS 文档似乎正在摆脱程序编辑器文档,就像一个尴尬的成年人可能会对他们十几岁时的糟糕发型图片所做的那样。
祝您The COLS line command displays a special line that indicates the column numbers across the Program Editor window.
在documentation.sas.com 上找到好运,但我找不到。
</NOSTALGIA>
推荐阅读
- python-3.x - 在 Tkinter GUI 上嵌入 matplotlib 图
- c++ - 为类提供自己的数据
- apache-spark - 如何在每个 Worker 中的 Spark Dataframe 中加载数据,以防止将大量数据加载到 Master 节点
- python - Pandas Groupby + Agg 上架速度非常慢
- tensorflow - Keras MaxPooling2D 中的 None 步幅是否根据过滤器大小动态设置?
- c++ - 嵌套循环边界
- .net-core - 我们可以使用 .Net 中的 FFMPEG 工具在生成的视频上添加背景音乐和帧率吗?
- python - Getting ValueError rending my Django CreateView
- c - 移动光标转义序列
- node.js - 节点 js 作为网络服务器使用过多的 if 条件来服务器静态文件