由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - how to use Scan in SAS (so it works like parse in excel)
相关主题
请教SAS Base50中的41题count unique values in file with 1 million rows
excel问题 求教Another SAS question
请教SAS ODS to Excel请教一个SAS问题
[合集] 面试求教 Proc Import from Excel options【包子】SAS 日期和时间问题
large dataset impot into SASsas help
A SAS Multiple Comparison ProblemHow to convert a SAS char variable to a date variable.
问题又来了。SAS读excel的问题。请教两个关于SAS的问题
SAS help: how to count missing values of columns in a datasets急问
相关话题的讨论汇总
话题: scan话题: sas话题: 2011话题: 8000话题: 5000
进入Statistics版参与讨论
1 (共1页)
C**********o
发帖数: 658
1
Hello,
I have a columns that contains value like “1/1/2011|5000,3/1/2013|8000”,
or "“1/1/2011|5000,3/1/2011|8000,4/5/2012|3456”, etc. The value can be
blank, or can be as much as 35 counts (identified by ",").
How can I do it in SAS to separate all these values by ","?
My purpose is to count how many values in each cell in this column (by ","),
and see how many months away of the last 2 value.
Thanks!
l****u
发帖数: 529
2
建议学会使用google
S******y
发帖数: 1123
3
In Python, it would be a one liner -
s='1/1/2011|5000,3/1/2011|8000,4/5/2012|3456'
print len(s.split(','))
---
欢迎浏览Python/R/Hadoop实战速成课网页-
http://plus.google.com/+statsGuyMITBBS/about
a*******y
发帖数: 105
4
data A;
input records $ 1-50;
cards;
1/1/2011|5000,3/1/2013|8000
1/1/2011|5000,3/1/2011|8000,4/5/2012|3456
;
run;
data B; set A;
count=countw(records, ',');
if count >= 2 then do;
month2=input(scan(scan(records, count, ','),1,'|'), MMDDYY10.);
month1=input(scan(scan(records, count-1, ','),1,'|'), MMDDYY10.);
monthbetween=intck('Month',month1, month2, 'C');
end;
run;
C**********o
发帖数: 658
5
Thanks!!
1 (共1页)
进入Statistics版参与讨论
相关主题
急问large dataset impot into SAS
请教SAS base的几道题A SAS Multiple Comparison Problem
请教一个SAS问题问题又来了。SAS读excel的问题。
请教一个SAS问题SAS help: how to count missing values of columns in a datasets
请教SAS Base50中的41题count unique values in file with 1 million rows
excel问题 求教Another SAS question
请教SAS ODS to Excel请教一个SAS问题
[合集] 面试求教 Proc Import from Excel options【包子】SAS 日期和时间问题
相关话题的讨论汇总
话题: scan话题: sas话题: 2011话题: 8000话题: 5000