由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - 大牛帮忙:批处理读入多个文件!!
相关主题
[合集] 一个sas问题SAS使用到什么水平才算是高手?
how to use first.var in sas macro?一道SAS面试题,关于dummy variable
SAS问题请教SAS SUGI paper里提供的macro是要向作者买吗?
问一个sas问题急问,在线等:SAS adv certification Question about SELECT v.s IF/THEN ELSE
SAS help : The scope of macro variables一个关于macro的问题,多谢。
【大包子】如何让SAS读入中文变量名在 R 里面如何循环调用变量名
如何合并两个数据文件 (转载)SAS中如何只保留变量名中含有reading的变量啊
import csv file 后data有问题急问:SAS batch submission with macro variable
相关话题的讨论汇总
话题: blah话题: 变量名话题: numeric话题: variable话题: name
进入Statistics版参与讨论
1 (共1页)
s*******m
发帖数: 153
1
400+ txt 文件,包含变量名, 批处理读入时候, 需要从第8 or 9 行读起,
废话
废话
废话
(空白)
(空白)
VARIABLE FIELD DEC.
NAME TYPE POS. VARIABLE DESCRIPTION
--------------- ------- ---- --------------------------------------
变量名1 Numeric 0 blah,blah
变量名2 Numeric 0 blah,blah
变量名3 Numeric 0 blah,blah
p********a
发帖数: 5352
2
SAS MACRO 能处理这个。多读读SUGI吧。
s*r
发帖数: 2757
3
30 $ paypal i will deliver the contents in a single sas data

【在 s*******m 的大作中提到】
: 400+ txt 文件,包含变量名, 批处理读入时候, 需要从第8 or 9 行读起,
: 废话
: 废话
: 废话
: (空白)
: (空白)
: VARIABLE FIELD DEC.
: NAME TYPE POS. VARIABLE DESCRIPTION
: --------------- ------- ---- --------------------------------------
: 变量名1 Numeric 0 blah,blah

P****D
发帖数: 11146
4
没看懂。你给的那个例子明显是个data dictionary,不是实际数据。那你的实际数据
到底在哪?还有“一一对应”到底怎么个对应法?
我也不喜欢inputking。在线中文输入法推荐sevenforks.com。“千率即穷”乐死我了
……
D******n
发帖数: 2836
5
同不明白真正的数据是怎么样的

【在 P****D 的大作中提到】
: 没看懂。你给的那个例子明显是个data dictionary,不是实际数据。那你的实际数据
: 到底在哪?还有“一一对应”到底怎么个对应法?
: 我也不喜欢inputking。在线中文输入法推荐sevenforks.com。“千率即穷”乐死我了
: ……

s*******m
发帖数: 153
6
two types of data files, one contains Var Names, "data dictionary".
var name 1
var name 2
var name 3
.
.
.
the other one contains real data
100,200, 300, .....,
150,250,350,....,
I want to merge them into a SAS dataset
var name 1, var name 2, var name 3,....
100,200,300,...
150,250,350,...
Since there are too many files, I have to use Macro or do loops? (I am a SAS
nuts, so please bear with me)
The Macro I searched can read in multiple txt files and save as sas files.
But the command he used is
s*******m
发帖数: 153
7
spent the last couple of nights digging out SUGI. no clue. :(
The SAS procs I've used are mainly regressions, very basic stuff. No
experience with Macro. Any suggestions on Macro basics??
bow//

【在 p********a 的大作中提到】
: SAS MACRO 能处理这个。多读读SUGI吧。
s*******m
发帖数: 153
8
i have no paypal. ??

【在 s*r 的大作中提到】
: 30 $ paypal i will deliver the contents in a single sas data
p********a
发帖数: 5352
9
你如果没有EXPERIENCE,再读书也写不出来的。我看你还是出30元让SIR给你做吧,她
应该能行
s*******m
发帖数: 153
10
en, msged Sir, so Sir has a good reputation here? Sorry I am new.

【在 p********a 的大作中提到】
: 你如果没有EXPERIENCE,再读书也写不出来的。我看你还是出30元让SIR给你做吧,她
: 应该能行

相关主题
【大包子】如何让SAS读入中文变量名SAS使用到什么水平才算是高手?
如何合并两个数据文件 (转载)一道SAS面试题,关于dummy variable
import csv file 后data有问题SAS SUGI paper里提供的macro是要向作者买吗?
进入Statistics版参与讨论
z**k
发帖数: 378
11
用Perl把前面的废话去掉不就行了,也就几行代码的事情。SAS Macro太不efficient了

【在 s*******m 的大作中提到】
: en, msged Sir, so Sir has a good reputation here? Sorry I am new.
s*r
发帖数: 2757
12
no
i have a reputation of asking for real money from strangers

【在 s*******m 的大作中提到】
: en, msged Sir, so Sir has a good reputation here? Sorry I am new.
p********a
发帖数: 5352
13
严禁调戏strangers

【在 s*r 的大作中提到】
: no
: i have a reputation of asking for real money from strangers

s*******m
发帖数: 153
14
haha, that is okay, as long as I can get my pain on ass removed. I don't
care to be 调戏ed.

【在 p********a 的大作中提到】
: 严禁调戏strangers
N**D
发帖数: 10322
15
perl

【在 s*******m 的大作中提到】
: 400+ txt 文件,包含变量名, 批处理读入时候, 需要从第8 or 9 行读起,
: 废话
: 废话
: 废话
: (空白)
: (空白)
: VARIABLE FIELD DEC.
: NAME TYPE POS. VARIABLE DESCRIPTION
: --------------- ------- ---- --------------------------------------
: 变量名1 Numeric 0 blah,blah

g**********t
发帖数: 475
16
你把input文件和output文件的样本贴上来(贴子里没说清楚),我明天看paper看累了
帮你写个perl脚本。
n*****3
发帖数: 1584
17
if geneticdrift would not paper看累了 , I charge only 25$ -)
if u not happy with the sample output, no need to pay at all.
Now I could be a independent contract for once. -)

【在 g**********t 的大作中提到】
: 你把input文件和output文件的样本贴上来(贴子里没说清楚),我明天看paper看累了
: 帮你写个perl脚本。

s*******m
发帖数: 153
18
geneticdrift,
image附件实在没有搞定, 只好copy paste. I hope this does make some sense. I
don't know how to thank you. But I really appreciate your valuable time.
我说的两种文件,一个'D_RC_0300' 包含变量名 (in a messy way, I
only need to pick up the first column which is called Variable Name, save as
N x 1 matrix),一个'RC_0300' 包含数据 (100 or so x N matrix)
。我需要产生一个新文件,变量名和数据一一对应, ((100 or so +1 ) x N).
The problem is I have this kind of table dataset in each quarter in each
year. The third Excel file is the lists of two set

【在 g**********t 的大作中提到】
: 你把input文件和output文件的样本贴上来(贴子里没说清楚),我明天看paper看累了
: 帮你写个perl脚本。

s*******m
发帖数: 153
19
thank you, will do if geneticdrift would not paper看累了, :)

【在 n*****3 的大作中提到】
: if geneticdrift would not paper看累了 , I charge only 25$ -)
: if u not happy with the sample output, no need to pay at all.
: Now I could be a independent contract for once. -)

D******n
发帖数: 2836
20
for i in RC_*; do grep Numeric D_$i|awk '{ORS=",";print $1}' > temp;cat temp
$i>H_$i;done

【在 s*******m 的大作中提到】
: thank you, will do if geneticdrift would not paper看累了, :)
相关主题
急问,在线等:SAS adv certification Question about SELECT v.s IF/THEN ELSESAS中如何只保留变量名中含有reading的变量啊
一个关于macro的问题,多谢。急问:SAS batch submission with macro variable
在 R 里面如何循环调用变量名SAS Macro 问题请教 。。。
进入Statistics版参与讨论
s*******m
发帖数: 153
21
er, 牛ren, pls talk in the language I can understand. :( Is this code in
Perl? When I googled Perl, I saw a huge and tempting strawberry. That is the
only impression I have about Perl. 555~~~

temp

【在 D******n 的大作中提到】
: for i in RC_*; do grep Numeric D_$i|awk '{ORS=",";print $1}' > temp;cat temp
: $i>H_$i;done

D******n
发帖数: 2836
22
if u run it on linux, use my code, otherwise neglect it.
it is a bash script

the

【在 s*******m 的大作中提到】
: er, 牛ren, pls talk in the language I can understand. :( Is this code in
: Perl? When I googled Perl, I saw a huge and tempting strawberry. That is the
: only impression I have about Perl. 555~~~
:
: temp

g**********t
发帖数: 475
23
#!/usr/bin/perl -w
use strict;
opendir DIR, "./" or die "$!\n";
for (grep {m/^RC_/} readdir DIR){
open IN, $_ or die "$1\n";
open OUT, ">C_$_" or die "$!\n";
print OUT (join (",", grep {$_} map {$1 if /^\s*([^\s]+)\s+Numeric/} <
IN>), "\n");
close IN;
open IN, "D_$_" or die "$!\n";
print OUT ;
close IN;
close OUT;
}
代码保存为.pl文件放到数据文件夹下直接运行即可
s*******m
发帖数: 153
24
Thanks so much, geneticdrift, will try it tonight.
s*******m
发帖数: 153
25
Hello, 楼上的牛人们,I think my problem is kind of solved. Really appreciate
your replies. 包子答谢. But since I have not done 发包子 before, it may
take a while. :D
另外,请您受到包子,麻烦告我一声,我好知道包子真发到拉.
D******n
发帖数: 2836
26
谢包子
不知道是什么馅的

appreciate

【在 s*******m 的大作中提到】
: Hello, 楼上的牛人们,I think my problem is kind of solved. Really appreciate
: your replies. 包子答谢. But since I have not done 发包子 before, it may
: take a while. :D
: 另外,请您受到包子,麻烦告我一声,我好知道包子真发到拉.

s*******m
发帖数: 153
27
馅的? you mean 双黄??
Did you take the Atlanta offer? If so, Congrats! I like ATL, house price,
not bad, also convenient as for dining and shopping

【在 D******n 的大作中提到】
: 谢包子
: 不知道是什么馅的
:
: appreciate

D******n
发帖数: 2836
28
yes, i did, thanks, good to know.

【在 s*******m 的大作中提到】
: 馅的? you mean 双黄??
: Did you take the Atlanta offer? If so, Congrats! I like ATL, house price,
: not bad, also convenient as for dining and shopping

p********a
发帖数: 5352
29
谢包子,最后你用谁的方法解决的?
D******n
发帖数: 2836
30
I bet perl

【在 p********a 的大作中提到】
: 谢包子,最后你用谁的方法解决的?
相关主题
Re: SAS help : How to use Macro to select procedurshow to use first.var in sas macro?
sas 中如何给一个variable 加密?SAS问题请教
[合集] 一个sas问题问一个sas问题
进入Statistics版参与讨论
g**********t
发帖数: 475
31

appreciate
Thanks for your 包子.

【在 s*******m 的大作中提到】
: Hello, 楼上的牛人们,I think my problem is kind of solved. Really appreciate
: your replies. 包子答谢. But since I have not done 发包子 before, it may
: take a while. :D
: 另外,请您受到包子,麻烦告我一声,我好知道包子真发到拉.

s*******m
发帖数: 153
32
In case, any of you have not heard yet or have not voted yet. Please log in
your facebook and vote for Chinese charity ! Tomorrow is the last day and we
are losing it ! $1,000,000
http://www.chinesevolunteers.org/
I am begging every friend to vote. I feel bad if we lose it, there is one
Chinese among five people in the world. So pls !
s*r
发帖数: 2757
33
how much did you get?

【在 g**********t 的大作中提到】
:
: appreciate
: Thanks for your 包子.

1 (共1页)
进入Statistics版参与讨论
相关主题
急问:SAS batch submission with macro variableSAS help : The scope of macro variables
SAS Macro 问题请教 。。。【大包子】如何让SAS读入中文变量名
Re: SAS help : How to use Macro to select procedurs如何合并两个数据文件 (转载)
sas 中如何给一个variable 加密?import csv file 后data有问题
[合集] 一个sas问题SAS使用到什么水平才算是高手?
how to use first.var in sas macro?一道SAS面试题,关于dummy variable
SAS问题请教SAS SUGI paper里提供的macro是要向作者买吗?
问一个sas问题急问,在线等:SAS adv certification Question about SELECT v.s IF/THEN ELSE
相关话题的讨论汇总
话题: blah话题: 变量名话题: numeric话题: variable话题: name