由买买提看人间百态

topics

全部话题 - 话题: infile
首页 上页 1 2 3 4 5 6 7 下页 末页 (共7页)
d*******o
发帖数: 493
1
来自主题: Statistics版 - SAS 数据读入的问题 (proc import)
Once you use Proc Import, you will eventually have data step infile code on
your log windows. Copy it and save it for future use. Once you like to
change any format, change the data step infile code, instead of your proc
import.
s******y
发帖数: 352
2
filename temp temp;
data _null_;
length temp $200.;
retain temp;
file temp;
infile datalines eof=end;

input;

if not missing(temp) and prxmatch("/^\s*\d{3}\s*/",scan(_infile_,1,
','))=0
then do;
temp=cats(temp,_infile_);
return;
end;
else if _n_>1 and prxmatch("/^\s*\d{3}\s*/",scan(_infile_,1,','))>0
then put temp;
temp=_infile_;
return;
end:put temp;
da... 阅读全帖
p*******0
发帖数: 420
3
The file Housing.txt contains a random sample of recently-sold houses in
two quadrants of a community.
The houses were very similar, differing in only two key respects: some
were located in the northwest quadrant of the
city (along the bordering river), while others were located in the
southeast quadrant of the city (along the bordering
mountains); and some were two-level structures while others were single-
level structures. The square footage (and
other key characteristic typically thought to ... 阅读全帖
d******9
发帖数: 404
4
Easy!
Just use infile:
Infile Fileref dlm=", /"
then SAS will treat both of them as delimiters.
Usually, if u use dlm="abc" then SAS regard each letter or any combination
of the 3 letters, a aa bb cc acb bca etc...as a delimiter. However, if you
use dlmstr="abc", then SAS only uses the STRING---abc-- as a delimiter.
l***a
发帖数: 12410
5
我以前弄过一个类似的步骤,code改一下帖这里,后面主要是import你可能用不到
options noxsync noxwait noxmin;
x "dir /b /s yourpath\import.csv";
options mprint mlogic;
%macro import(file, name);
data _&name.;
infile "&file";
run;
proc append base=total data=_&name. force;
run;
%mend import;
proc datasets lib=work;
delete total;
run;
data import;
infile 'yourpath\import.csv' truncover;
input file $100.;
length=index(upcase(reverse(scan(reverse(file),1,'\'))),'.TXT');
length name $20.;
if length>0 then do;
name=substr(revers... 阅读全帖
a*****9
发帖数: 1315
6
来自主题: Statistics版 - 请教一个SAS BASE题
i had this problem in class .
if then do end is a loop ; eq : if ;
data q;
infile datalines;
input City $20.;
if City='Tulsa'
State='OK';
Region='Central';
;
if City='Los Angeles'
State='CA';
Region='Western';
;
datalines;
Tulsa
Los Angeles
Bangor
;
run;
proc print data= q;
run;
data q;
infile datalines;
input City $20.;
if City='Tulsa' then do;
State='OK';
Region='Central';
end;
if City='Los ... 阅读全帖
o*******w
发帖数: 2310
7
来自主题: Statistics版 - 这sas BASE 考试很坑爹..
A raw data file is listed below:
RANCH,1250,2,1,Sheppard Avenue,"$64,000"
SPLIT,1190,1,1,Rand Street,"$65,850"
CONDO,1400,2,1.5,Market Street,"80,050"
TWOSTORY,1810,4,3,Garris Street,"$107,250"
RANCH,1500,3,3,Kemble Avenue,"$86,650"
SPLIT,1615,4,3,West Drive,"94,450"
SPLIT,1305,3,1.5,Graham Avenue,"$73,650"
The following SAS program is submitted using the raw data file as input:
data work.condo_ranch;
infile 'file-specification' dsd;
input style $ @;
if style = 'CONDO' or style = 'RANCH' then
in... 阅读全帖
w********m
发帖数: 1137
8
readMERLIN <- function(infile) {
x <- file(infile, "r")
repeat {
rl <- readLines(x, n=1)
if (length(rl) == 0) break
if (length(grep("lnLikelihood", rl)) > 0) {
return( as.double(strsplit(rl, split= "=")[[1]][2]) )
}
}
}

y <- readMERLIN("test.txt")

analysis,
s******y
发帖数: 352
9
来自主题: Statistics版 - SAS MACRO question (包子求教重金酬谢)
%let dirpath=d:;
filename csvfile pipe "dir /b &dirpath.\*.csv";
data allcsv;
infile csvfile lrecl=1000;
input;
fname=catx('',"&dirpath.",_infile_);
infile dummy filevar=fname filename=myfile end=done firstobs=4
dsd truncover;
do while(not done);

input date :date9. Tier :$50. Ccy :$50.
Doc :$50. Sd1y :percent. Sd2y :percent.;

output;
end;
put 'Done with ' myfile=;
run;

external
k******u
发帖数: 250
10
来自主题: Statistics版 - SAS 问题求助 -- create new variable
创建一个新的variable z,用如下code
data bank;
infile 'C:bankdata.txt' firstobs =2;
input Name $ 1-15
Acct $ 16-20
x 21-26
y 27-30;
z = x * y;
run;
proc print data = bank;
run;
这个程序works good,
但是当我把infile 去掉,用datalines;的statement输入x y的值,同时在data中计算
z=x*y,却被告知statement is not valid。
为什么呢?
w**2
发帖数: 147
11
来自主题: Statistics版 - 求助SAS advanced真题第21题
请问大牛们如何理解以下的这个程序,多谢。
The following SAS program is submitted:
data WORK.NEW;
do i=1, 2, 3;
Next=cats('March' || i );
infile XYZ
filevar=Next
end=Eof;
do until (Eof);
input Dept $ Sales;
end;
end;
run;
The purpose of the FILEVAR=option on the
INFILE statement is to name the variable
Next, whose value:
A.
points to a new input file.
B.
is output to the SAS data set WO... 阅读全帖
b*******z
发帖数: 155
12
来自主题: Statistics版 - 请问一道sas base的题
data temp;
infile datalines dsd;
input a $;
datalines;
RANCH,12322,2,1 AVENUE
;
run;
proc print data=temp;
run;
run出来,为什么a是RANCH而不是RANCH,12322,2,1呢
我记得infile的option如果不specify dlm的话,默认是space,为什么这里sas自动辨
认出dlm是逗号了呢
谢谢
H******e
发帖数: 333
13
这是123题的第15题
The following SAS program is submitted:
data numrecords;
infile 'file-specification';
input @1 patient 15.relative 16-26 @;
if relative = 'children' then
input @54 diagnosis 15.@;elseifrelative=′parents′theninput@28doctor15.
clinic 44−53@54diagnosis15. @;
input age;
run;
How many raw data records are read during each iteration of the DATA step
during execution?
A. 1
B. 2
C. 3
D. 4
这是70题的第29题
data WORK.INFO;
infile 'DATAFILE.TXT';
input @1 Company 20.@25State2. @;
... 阅读全帖
H******e
发帖数: 333
14
123题的41:
The contents of the raw data file SIZE are listed below:
--------10-------20-------30
72 95
The following SAS program is submitted:
data test;
infile 'size';
input @1 height 2. @4 weight 2;
run;
Which one of the following is the value of the variable WEIGHT in the
output data set?
A. 2
B. 72
C. 95
D. . (missing numeric value)
50题的41:
A raw data file is listed below.
1---+------10---+----20---+---
01/05/1989 Frank 11
12/25/1987 June 13
01/05/1991 Sally 9
Th... 阅读全帖
l*********o
发帖数: 3091
15
来自主题: DataSciences版 - Data scientist--Zillow电面
#include
#include
#include
#include
using namespace std;
class Element
{
public:
int time;
int count;
Element(int t, int c)
{
time = t;
count = c;
}
};
class IPRecord
{
public:
queue q;
int total_attack;
void add_to_queue(int t, int c)
{
Element ele = Element(t, c);
q.push(ele);
total_attack += c;
}
void normalize_queue()
{
while (q.back().time - q.front().time... 阅读全帖
f*****b
发帖数: 1649
16
来自主题: Living版 - 买老房子的问题

一般不会
找本地contractor打电话估价,免费的
同上
可以做一个匹配的面板infill,电器嵌在面板里面
多半是locking clip磨损了,老窗户的话多半可以换一个,不用整个换窗户。
BR
发帖数: 4151
17
我要申请贷款,贷款机构查了一下我的credits, 给我发了一份merged credit
infile report, 里面综合了三家credit bureau 的report。
其中不知道为什么Experian 说我有个serious delinquency。 再仔细看,CBNA (大概
是Credit Bureau of North America) 有一个$150的collection。我从来都按时付帐的
,不知道这个东西从哪里来的。report 上面信息太少。而experian 的电话只管 order
credit report, 不管回答credit report 上面的问题。怎么办?
谢谢。
t*******0
发帖数: 42
18
Hovnanian Enterprises, Inc. engages in homebuilding and financial services
businesses in the United States. The company designs, constructs, markets,
and sells single-family detached homes, attached townhomes and condominiums,
mid-rise and high-rise condominiums, urban infill, and active adult homes.
It markets and builds homes for first-time buyers, first and second-time
move-up buyers, luxury buyers, active adult buyers, and empty nesters. The
company offers homes for sale in 192 communities i... 阅读全帖
t******g
发帖数: 17520
19
来自主题: TVGame版 - KZ3视频
嗯,是,打TDM 如果己方队友比较呆, 被人围了, 我死了重生在他们周围,用infil
trator 的话,效用不是很大, 还不如engineer 或是 marksman, 防御性强些
W******z
发帖数: 702
20
来自主题: E-Sports版 - 同志们,口水吧。

geekhack.org,宅男集中营
现在最廉价的pad print方式反而不容易褪色,你要是有5块钱dell,逻辑那种键盘就都
是这样,刻字就是一个贴纸贴上去凸出来,手指能感觉出来的那种。
反而很多机械键盘的laser infill,容易褪色,
b2
发帖数: 427
21
【 以下文字转载自 Statistics 讨论区 】
发信人: b2 (维生素), 信区: Statistics
标 题: 关于SAS读数据紧急求助,包子答谢,谢谢了先
发信站: BBS 未名空间站 (Sun Jun 13 00:05:40 2010, 美东)
我又一组数据,20个变量,大约700万个观测值存在csv里面。
1 双击文件用excel打开一部分,会损坏原始文件么?
2 这二十个变量再csv文件里被分布在3个列里面,用|分割,具体情况是:
1)每个列里面含有的变量数不同,即 对于某些观测值column 1可能含5个变量,而对
于其他的观测,
第一列可能有8个变量;
2)某些观测,有的变量内容每分隔在不同的列里面;
3)同一变量内部,每个观测值的长度也不同;
我试过
data _null;
infile 'path' dsd firstobs=2 dlm=',' dlm='|';
input v1 $ v2 $ ... v20 $;
run;
或者
1 读入SAS;2输出每个列到新的csv文件中;但是每个列有含有不同数量的变量数。比
较麻烦,
请问有谁能指点我一下,谢谢!
c*****s
发帖数: 180
22
来自主题: WaterWorld版 - PURE WATER DO NOT NETER PLEASE
SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 7 of 28
backnextlesson menuLearning Pathhelp menu

Using an INFILE Statement (continued)
Using the COMPRESS Function
Note the space between month and 9 in c:\sasuser\month 9.dat. You can
eliminate the space by using the COMPRESS function.
When i= nextfile=
9
c:\sasuser\month 9.dat
10
c:\sasuser\month10.dat
11
c:\sasuser\month11.dat
General form, COMPRESS function:
COMPRESS(source,
c*****s
发帖数: 180
23
来自主题: WaterWorld版 - PURE WATER DO NOT NETER PLEASE
SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 8 of 28
backnextlesson menuLearning Pathhelp menu

Using an INFILE Statement (continued)
Using the END= Option
When you read past the last record in a raw data file, the DATA step
normally stops processing. In this case, you need to read the last record in
the first two raw data files. However, you do not want to read past the
last record in either of those files because the DATA step will stop
proce
c*****s
发帖数: 180
24
来自主题: WaterWorld版 - PURE WATER DO NOT NETER PLEASE
SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 10 of 28
backnextlesson menuLearning Pathhelp menu

Using an INFILE Statement (continued)
?

Which of the following statements correctly assigns the names of the raw
data files Movies_April.dat, Movies_May.dat, and Movies_June.dat to the
variable nextfile? The values of i are April, May, and June.

nextfile="c:\flights\movies_"
!!compress(put(i,$4.)!!".dat",' ');


nextfile="c:\f
c*****s
发帖数: 180
25
来自主题: WaterWorld版 - PURE WATER DO NOT NETER PLEASE
SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 11 of 28
backnextlesson menuLearning Pathhelp menu

Using an INFILE Statement (continued)
question

Write an assignment statement that uses the COMPRESS function to remove the
character string Special from the values of the variable Menu. Name the new
variable Var.


Copyright© 2005 SAS Institute Inc., Cary, NC, USA. All rights
reserved.
Terms of Use & Legal Information | Pr
c*****s
发帖数: 180
26
来自主题: WaterWorld版 - PURE WATER DO NOT NETER PLEASE
SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 14 of 28
backnextlesson menuLearning Pathhelp menu

Using an INFILE Statement (continued)
Using the INTNX Function
In the previous example the current month was October. What happens if the
current month is January or February?
Suppose the current date is February 16, 2003. Using the following program,
the values for midmon (January) and lastmon (December) would be 1 and 0
respectively. Since there i
D******6
发帖数: 6211
27
【 以下文字转载自 Statistics 讨论区 】
发信人: Doha2006 (花猫), 信区: Statistics
标 题: 请教一个SAS读中文数据库的问题
发信站: BBS 未名空间站 (Sun Feb 21 23:45:37 2010, 美东)
我用SAS读一个中文数据库,字符字段
源文件如下:
id name address
1, 张三,北京市东城区
2,李四,北京市西城区
。。。
。。。
我用的代码如下:
DATA name;
infile 'G:\name.csv' DLM = ',' DSD MISSOVER;
input id $ name $ address $;
读到SAS里的结果如下:
id name address
1 张三 北京市东
2 李四 北京市西
现在出现的问题是,如果address太长或者任何字符字段长过8个都读不进去,读到SAS
里以后,只有4个中文字符,也就是字节长8 。不是说以$这样结尾读数据都是按照有多
长读多长么?还是哪里有什么限制,我没有打开?
谢谢指点!
A*********u
发帖数: 8976
28
input id $ name $ address :$200;

【 以下文字转载自 Statistics 讨论区 】
发信人: Doha2006 (花猫), 信区: Statistics
标 题: 请教一个SAS读中文数据库的问题
发信站: BBS 未名空间站 (Sun Feb 21 23:45:37 2010, 美东)
我用SAS读一个中文数据库,字符字段
源文件如下:
id name address
1, 张三,北京市东城区
2,李四,北京市西城区
。。。
。。。
我用的代码如下:
DATA name;
infile 'G:\name.csv' DLM = ',' DSD MISSOVER;
input id $ name $ address $;
读到SAS里的结果如下:
id name address
1 张三 北京市东
2 李四 北京市西
现在出现的问题是,如果address太长或者任何字符字段长过8个都读不进去,读到SAS
里以后,只有4个中文字符,也就是字节长8 。不是说以$这样结尾读数据都是按照有多
长读多长么?还是哪里有什么限制,我没有打开?
谢谢指点!
D******6
发帖数: 6211
29
来自主题: ChineseClassics版 - 请教一个SAS读中文数据库的问题 (转载)
【 以下文字转载自 Statistics 讨论区 】
发信人: Doha2006 (花猫), 信区: Statistics
标 题: 请教一个SAS读中文数据库的问题
发信站: BBS 未名空间站 (Sun Feb 21 23:45:37 2010, 美东)
我用SAS读一个中文数据库,字符字段
源文件如下:
id name address
1, 张三,北京市东城区
2,李四,北京市西城区
。。。
。。。
我用的代码如下:
DATA name;
infile 'G:\name.csv' DLM = ',' DSD MISSOVER;
input id $ name $ address $;
读到SAS里的结果如下:
id name address
1 张三 北京市东
2 李四 北京市西
现在出现的问题是,如果address太长或者任何字符字段长过8个都读不进去,读到SAS
里以后,只有4个中文字符,也就是字节长8 。不是说以$这样结尾读数据都是按照有多
长读多长么?还是哪里有什么限制,我没有打开?
谢谢指点!
r****y
发帖数: 26819
30
来自主题: ChineseClassics版 - 请教一个SAS读中文数据库的问题 (转载)
load data local infile 'name.csv' into table contacts
fields terminated by ','
enclosed by '"'
lines terminated by '\n'
(id, name, address)
h**e
发帖数: 1
31
来自主题: Database版 - 非高人莫答
建了一个表:
CREATE TABLE aa
( id NUMBER,
description VARCHAR2(3000));
用SQLLDR, CONTROL FILE 如下:
LOAD DATA
INFILE 'D:\desc.CSV'
INTO TABLE AA
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
(
id,
description
)
desc.CSV:
1001,"Former telephone-service sales agency CTC
Communications Group is morphing into a marketer of multiple
modes of modern media. It holds CTC Communications Corp.,
which sells integrated telecommunications services,
including local and long-distance, network products and
servi
j*****k
发帖数: 1
32
来自主题: Database版 - How to load data into Mysql from txt file?
I tried to load a text file into an empty table,with "load data local infile
"file.txt" into table tablename", got error 1148:
the used command is not allowed with is MySQL version
My version is 3.23.52 and the manual dose suggests using load data.
Anybody can help?
o***z
发帖数: 133
33
来自主题: Database版 - How to load data into Mysql from txt file?
it's disabled by default for security reason
you need to invoke the client with --local-infile=1
mysql --help for more information
s**********i
发帖数: 711
34
来自主题: Database版 - How to load data into Mysql from txt file?

yes, loading local file is not enabled by default.
can upload to server first then use
load data infile
s****e
发帖数: 2
35
我用的系统是AIX,目前用户没有文件大小的限制。
而我在mysql里用“load data infile 文件名 into table 表名;”命令
时发生了错误:ERROR 1030: Got error 27 from table handler
这是怎么回事?
我查看表的情况,其中Rows=1473148,Data_length=1073844384。
也就是说当mysql添加数据到1473148行左右时出错了!
为什么呢?
Max_data_length可是有4294967295的阿~~
我的max_rows也有5000000
麻烦高手解释,无限感激!!
f*******i
发帖数: 459
36
来自主题: Database版 - 怎么自动UPDATE
我有个PLAIN FILE在SOLARIS下, 每天自动UPDATE,
我想把数据放到MYSQL数据库下, 在MYSQL里我用LOAD DATA INFILE
但是如果我不想直接在数据库里处理, 我从UNIX下放到MYSQL, 那用什么命令?
k**e
发帖数: 86
37
来自主题: Database版 - Looking help on ORACLE SQL Loader
I try to do some manipulation with the input INFILE file name for some of the
columns in Oracle SQL Loader. Is there any keyword or internal variable in 8i
to get this filename?
L******r
发帖数: 199
38
来自主题: Database版 - 怎么我的load data 命令不行?
mysql> LOAD DATA LOCAL INFILE "C:\\alldic.txt" INTO table alladjv;
ERROR 2 (HY000): File 'C:\alldic.txt' not found (Errcode: 2)
L******r
发帖数: 199
39
1.用load data infile,还有别的办法?
2.上百亿
3.格式如下:Word_0[SPACE]Word_1[SPACE]Word_2[SPACE ]Word_3[TAB]Number_0
谢谢
o**********a
发帖数: 330
40
ruo ruo de wen:
i have a file 'student.text' in c:\my documents\
so how to load it into mysql
thanks!
c*****y
发帖数: 75
41
用SSIS 就可以
w*m
发帖数: 1806
42
来自主题: Database版 - sqlloader
LOAD DATA
INFILE 'input_File.csv’
INTO TABLE tableName
FIELDS TERMINATED BY ","
(field1,
field2,
field3,
field4)
....
question: 可不可以在字段后面加上一个"select id from..."来自动赋值给某一字段?
f******h
发帖数: 159
43
有csv形式的file么?
还是只有SQL?
有其他形式的FILE,可以用 load data infile .....into table
比insert 快多了
d****u
发帖数: 275
44
来自主题: Database版 - 急问:导入XML文件到MySQL数据库
各位大侠,我需要将一堆xml数据导入mysql的数据库中,
xml文件名001,输入的表是mytable,xml文件以rootTag开始,
运行的情况是,我的表里边相应的column都更新了,但是没有任何数值;
请问这段script到底哪里出错了??非常感谢!!
LOAD DATA LOCAL INFILE 'H:\\XXX\\2011\\001.xml'
INTO TABLE mydatabase.mytable
LINES STARTING BY '' TERMINATED BY ''
(@award)
SET
AwardID = ExtractValue(@award, 'AwardID'),
FirstName = ExtractValue(@award, 'FirstName'),
LastName = ExtractValue(@award, 'LastName'),
EmailAddress= ExtractValue(@award, 'EmailAddress');
d****u
发帖数: 275
45
要load一堆数据入mysql,
notice_datetime是 datetime的,start和end是date
我写的script如下,大牛看看哪里有问题?
运行结果是,notice_date没法录入,start和end没有问题
非常感谢!
LOAD DATA LOCAL INFILE 'F:\\2012.csv'
INTO TABLE xx_DB.xx_table
terminated by ',' enclosed by '"' lines terminated by '\n' (
@NOTICE_DATETIME,
@START_DATE,
@END_DATE
)
SET
NOTICE_DATETIME = CAST(@NOTICE_DATETIME AS DATETIME),
START = STR_TO_DATE(@START, '%m/%d/%Y'),
END = STR_TO_DATE(@END, '%m/%d/%Y');
r****5
发帖数: 618
46
来自主题: Database版 - Load .cvs to database
I have a .cvs file to load to database. The requirement are:
• In cases with first, last, and middle names, the names should be
merged into a single field as “Lastname, Firstname”
• Any records with an “Address2” value should have both address
parts combined into a single field
• Also, be sure to specify a BAD file location as you will need to
process the records in this file in the steps that follow.
My control file is:
REM This is to load a file, Part 1, assignment 3
LOAD D... 阅读全帖
l******y
发帖数: 60
47
大牛们,有没有可以import txt或 xls的sql命令?table 已经建好,但不用sqlloader
,也不用toad中的import功能,就是sql 命令,写入script可以直接运行的?
就像SAS 中的
data XXX
infile '.....a.txt'...
或者把文件中的内容直接输入,类似SAS中的 dataline.....,但不要一行一行地
insert
多谢啦
B*****g
发帖数: 34098
48
把infile从control file里拿掉
sqlldr ... control=??? data=???
n****f
发帖数: 905
49
来自主题: Database版 - C# DateTime to Oracle Date (转载)
这个任务可以直接完成, 不用借助 C#。
1. 在 Oracle 建立一个表:
CREATE TABLE oldmanpushca.DATE_TEST
(
COL1 VARCHAR2(100 BYTE),
COL_DATE DATE
);
2. 用 NOTEPAD 在 C:\OracleLoader\ 盘建立了一个 CSV 文件:
C:\OracleLoader\DATE_TEST.CSV, 内容如下:
C1R1 TEXT 1, 2013/10/22
C1R2 TEXT 2, 2014/10/22
C1R3 TEXT 3, 2015/10/22
3. 用 NOTEPAD 在 C:\OracleLoader\ 盘建立了一个控制文件:
C:\OracleLoader\Para.CTL , 内容如下:
LOAD DATA
infile 'C:\OracleLoader\DATE_TEST.CSV'
APPEND
INTO TABLE oldmanpushca.DATE_TEST
FIELDS TERMINATED BY ',' optionally enclosed by... 阅读全帖
首页 上页 1 2 3 4 5 6 7 下页 末页 (共7页)