n****f 发帖数: 905 | 1 这个任务可以直接完成, 不用借助 C#。
这种方式容许你导入很大(1G,10G。。)的 CSV 文件。
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 TERMINATE... 阅读全帖 |
|
x*****u 发帖数: 3419 | 2 感谢! 但感觉这个-60不好把握,多了少了都成问题。
用getline应该更稳妥一点。
1 // istringstream::str
2 #include
3 #include
4 #include
5 #include
6 using namespace std;
7
8 int main () {
9
10 double val;
11
12 string file_name("Tnve.dat");
13 ifstream infile(file_name.c_str(),ios::in);
14 istringstream iss;
15 string strvalues,sv;
16
|
|
J*********r 发帖数: 5921 | 3 client向server要求test文件并顺利收到,但是用diff命令对两文件进行比较的时候,
哪怕两个文件一样
diff也会给出图2的提示,我知道这个提示的含义,问题是我在源文件test最末已经加
了newline了(如图1)
有什么办法消除这个提示么?另外,有时候没这个提示(在源文件很小的时候偶尔没有
),但diff会
只提示"Binary files A and B differ",test是用"rb"和"wb"方式读和创建的,有没
有比较二进制文件的命令?
多谢。
//图1
"....................................
fclose(infile);
close(sockfd);
return 0;
}
"
//图2
me@me-laptop:~$ diff server/test client/test
10973a10974
>
\ No newline at end of file
mee@me-laptop:~$ |
|
s***r 发帖数: 32 | 4 Hi,
I wanted to do sth like:
perl -F"\t" -lane "print $F[0], "TAB", log($F[1])" infile.txt
There is a problem with the TAB character: I can not find a way to represent
it in a way that perl recognize.
So I have to hack sth like:
perl -F"\t" -lane "print $F[0], _______, log($F[1]+1)" in.txt|perl -pi -e "s
/_______/\t/g"
Any better ways of doing it? Thanks! |
|
X****r 发帖数: 3557 | 5 Don't you need to esacpe $ against shell?
Under bash:
perl -F"\t" -lane "print \$F[0], \"\t\", log(\$F[1])" infile.txt
represent
e "s |
|
t****t 发帖数: 6806 | 6 it has nothing to do with tab, you are using wrong quotes (for shell)
perl -F"\t" -lane 'print $F[0], "\t", log($F[1])' infile.txt
represent
"s |
|
H***a 发帖数: 735 | 7 Np. My understanding is that (for your original code):
eof() or good() checks internal state flags "eofbit", which is modified when
getline() is encountered problem in reading from infile.
When getline() reads the last line, it stops by seeing the EOF, however it
consider this read is successful so won't flip eofbit to TRUE. The file
pointer moves to position of EOF (remember getline() returns istream&)
Since eofbit is still FALSE now, eof() or good() lets it loop over, getline(
) sees the EOF a... 阅读全帖 |
|
k*******3 发帖数: 1909 | 8 我在windows cmd下做了
type database.txt >> CGIMetPred.exe
然后把tool.exe复制到另一个文件夹,但是tool.exe运行说找不到database.txt文件
tool的cpp原程序中有一句
ifstream infile("database.txt");
如果找不到database.txt就会报错。
请问我应该如何修改?谢谢 |
|
k*******3 发帖数: 1909 | 9 就是说原程序中不能用
ifstream infile("database.txt");
来读取文件了对吗?
要改用指针?
谢谢 |
|
p**o 发帖数: 3409 | 10 open(outfile,'w').write(open(infile).read().replace('|', ',')) |
|
k**********g 发帖数: 989 | 11 Depends on how big the area is.
More precisely, what is the maximum distance from the set of missing pixels
to the nearest valid pixel.
The general technique is called Infilling.
Here's just an example from Google search result. http://research.microsoft.com/pubs/67276/criminisi_tip2004.pdf
When the text is very thin, a masked local averaging will do the job.
img = imread( filename ) ;
[ nrows, ncols, nchan ] = size ( img ) ;
imgColor = double ( img ) .* (1 / 255) ;
imgGray = rgb2gray ( imgColor... 阅读全帖 |
|
l******0 发帖数: 244 | 12 我有三个表,Term, Category, Category_Term, 多对多关系,很简单,Term 和
Category 只有 ID and Name 两个字段,Category_Term 是 intersection table, 存
储对应 Term and Category ID 的外部键。
使用 Load Data Local Infile,前两个表的 load 速度还比较快,5 百万的记录也就
几分钟导进去了。但是 Category_Term 出奇的慢,3 三百万的记录,几个小时才完。
数据库为 MariaDB (MySql), Linux.
难道向库中导数据的速度,跟表的结构有关。即使如此,也不应该这么慢。这可能是什
么原因? |
|
S*******s 发帖数: 13043 | 13 任务本身很简单,大概有几万个记录,对每个记录都要应用一大堆假设参数产生几百个
数,再对产生的几十个M的数根据各种组合进行汇总统计。
最开始用excel+vba实现很简单,运算都在内存中,那几百万个数在生成的时候就同时
汇总,算完了就扔所以内存也够用,算一次也就是100多秒。
后来放到云上用node.js+mysql就遇到问题了。开始的想法是把记录、参数放在数据库
里,算的时候前面js遍历每一条记录,把中间结果写回数据库里,再用sql group by汇
总。这样运算了一次以后结果已经cache在数据库里再次运算就不用像excel一样重算,
只要算那些以前没算过的了。但是实际运行以后发现写回数据库非常慢,改用load
data local infile之后的速度仍然无法接受,load个几百兆的文件也要几十分钟。
显然瓶颈是和数据库的io操作。如果仍然想保留cache机制大家有什么好建议吗?把所
有的逻辑都用存储过程在数据库端实现吗?存储过程做那些事很笨拙,直觉不像是个好
主意。 |
|
c*****t 发帖数: 1879 | 14 /* a code I wrote long time ago for this purpose */
#include
#include
#include
#include
#include
#include
#ifndef true
#define true 1
#define false 0
#endif
int Error (char *);
long filelength (FILE *f)
{
register long size, pos = ftell (f);
fseek (f, 0, SEEK_END);
size = ftell (f);
fseek (f, pos, SEEK_SET);
return size;
}
int writefile (FILE *infile, char *filename, long filesize)
{
FILE *outfile;
char buffer[409 |
|
g*******n 发帖数: 139 | 15 I can't find a binary version for this and compile the source code only got
errors.
The version I download is mrouted3.8.2-src.tar.gz.
The errors are below:
When I type the command below:
gcc -I ../snmplib -DDEBUG -DMROUTED -DHAVE_CONFIG_H -c -o snmpd.o snmpd.c
The error is:
Infile included from snmpd.c:39:
/usr/included/stdio.h:216 parse error before '0'
make[1]: *** [snmpd.o] Error 1
Who have installed it before, please help. Tell us where can find a good version
can use smoothly. |
|
D**e 发帖数: 10169 | 16 if you know the dimension of the matrix, it's easy. suppose it's MxN. and M/N
is not too large.
tail -n M infile | awk '{printf "%d %d ... %d\n", $1, $2, ..., $n}' > outfile |
|
p***g 发帖数: 3 | 17 关于FEMA 178 中结构的分类,怎么翻译?美国没有砖混结构、底框吗?
1 .Unreinforced Masonry Bearing Walls
2. Reinforced Masonry Bearing Walls with Pre-cast
Concrete Diaphragms
3. Concrete Moment Frame
4. Concrete Frame with Unreinforced Masonry Infill Walls
1.是砌体结构吗?
3 和4 哪个是我们常说的框架结构?
FEMA 178 中结构的分类:
Table A-1. Model building types as defined by HAZUS. |
|
A****F 发帖数: 699 | 18 多谢。我提到metal deck w/ concrete infill 不是用于这个地方,just in general,
how to provide bracing for steel beam.
另外,我不觉得木结构屋顶能给钢梁提供支撑,因为刚梁需要支撑时,木头早就没了
★ 发自iPhone App: ChineseWeb - 中文网站浏览器
★ 发自iPhone App: ChineseWeb - 中文网站浏览器 |
|
t***r 发帖数: 264 | 19 http://www.woodworks.org/education-event/webinar-bullitt-center
The Bullitt Center, a six-story heavy timber building recently completed in
Seattle, is predicted to be the world’s most energy-efficient commercial
building. It has been designed to last 250 years and to achieve the highest
benchmark of building sustainability—Living Building Challenge™ (LBC)
certification. A performance-based certification program, the LBC requires
buildings to be evaluated after one year of occupancy prior ... 阅读全帖 |
|
j******y 发帖数: 180 | 20 你的i,j 没有被initialize,同时读取失败,(fail to open, or fail to read), 所
以print出来是两个莫名奇妙的数。
另外,infile.close() |
|
j******y 发帖数: 180 | 21 你的i,j 没有被initialize,同时读取失败,(fail to open, or fail to read), 所
以print出来是两个莫名奇妙的数。
另外,infile.close() |
|
p********a 发帖数: 5352 | 22 ☆─────────────────────────────────────☆
ttsj (yuer) 于 (Wed Oct 10 19:47:54 2007) 提到:
raw data file某些行最后面有missing value,这个在infile后加missover就可以解决
,但现在第一行的一个value值有双引号,怎么把双引号去掉呢?而且双引号里面是有
空格的。谢谢了~
☆─────────────────────────────────────☆
papertigra (长工胖头猪) 于 (Wed Oct 10 21:20:31 2007) 提到:
dsd
☆─────────────────────────────────────☆
ttsj (yuer) 于 (Wed Oct 10 21:24:23 2007) 提到:
谢谢,是说dsd和missover一起用么?我试过好像不行,单独用也不行,应该怎么放?
☆─────────────────────────────────────☆
papertigra (长工胖头猪) 于 |
|
c*******7 发帖数: 2506 | 23 CODE如下。要对37个变量(RC1-RC37)进行同样的变换,生成37个新变量(RCT1-RCT37
),那些条件语句一个一个写起来太傻了。有什么简单的写法吗?
谢谢!
DATA A;
INFILE filename;
INPUT @7 (RC1-RC37) ($1.);
If RC1 in ("A", "B", "C", "D","E") then RCT1=1;
else if RC1 in ("0", "1","2","3","4","5") then RCT1=0;
If RC2 in ("A", "B", "C", "D","E") then RCT2=1;
else if RC2 in ("0", "1","2","3","4","5") then RCT2=0;
.
.
.
RUN; |
|
p********a 发帖数: 5352 | 24 ☆─────────────────────────────────────☆
chrd (绵羊) 于 (Thu Feb 22 09:53:12 2007) 提到:
我有很多文件如下(相同结构):
A_00001.txt
A_00002.txt
.
.
A_09999.txt
我想用一个简单的macro去批处理文件,读入sas 合并成一个data set。如果是A_1.TXT
形式,我知道如何做,但现在是00001,就出问题了。
%MACRO FILE;
data A_&I;
%do i=00001 %to 09999;
infile "d:\A_&i..txt";
file_id=&i;
%END;
%MEND;
sas总是认为i=1,2 ....
谢谢
☆─────────────────────────────────────☆
papertigra (长工胖头猪) 于 (Thu Feb 22 12:58:17 2007) 提到:
options macrogen;
data _null_;
do i=1 to 9999;
call symput('a'||l |
|
l****g 发帖数: 304 | 25 the following two questions are both about the "informat" at list input, why
the first use ":" after the variable birthdata, the second dose not use ":"
after the variable date?
Thanks very much.
The first:
A raw data file is listed below.
1---+----10---+----20---+---
son Frank 01/31/89
daughter June 12-25-87
brother Samuel 01/17/51
The following program is submitted using this file as input:
data work.family;
infile 'file-specification';
run;
Which INPUT statement |
|
l****a 发帖数: 336 | 26 数据保存在 111.txt 文件中
ASL32,SMITH AND SONS,1998
LAS484,MAJOR UNIVERSITY PRESS,1989
IOD859,SMITH AND SONS,1988
REU701,TOWN PRESS,1995
WRE142,LITTLE FEET,1990
我用的代码:
data publish;
infile '111.txt' dlm=',';
input BookID $ Publisher & $ Year;
run;
proc print data=publish;
run;
output完全错误 郁闷
Obs BookID Publisher Year
1 ASL32 SMITH AN .
2 IOD859 SMITH AN . |
|
w***z 发帖数: 28 | 27 data publish;
infile datalines dsd;
input BookID $ Publisher: $25. Year;
datalines;
ASL32,SMITH AND SONS,1998
LAS484,MAJOR UNIVERSITY PRESS,1989
IOD859,SMITH AND SONS,1988
REU701,TOWN PRESS,1995
WRE142,LITTLE FEET,1990
;
run;
proc print data=publish;
run; |
|
m********a 发帖数: 25 | 28 Raw data file:
John 35 71
June 10 43
Tineke 9 37
The SAS program:
Data homework;
Infile file;
If age le 10;
Run;
How many observations will homework data set contain?
答案说是3个,为什么不是2个?百思不得其解。请大虾讲讲。谢谢 |
|
p********a 发帖数: 5352 | 29 ☆─────────────────────────────────────☆
Plainsman (War Eagle) 于 (Mon Apr 21 20:03:38 2008) 提到:
要输入三个table然后用sql,
但是infile文件有问题,因为其中有个变量,既有字母也有数字,而且表中还有很多的
missing data。 该怎么输入数据呢?记录有几万条,不可能手动改啊?
大牛快救我!!!
数据比如说这样:
certno HCID memberno firstName LastName MI
13545899 321A61483 10 MARK ANDERSON
15426551 803A53858 10 JOE AUKSTOLIS
15426551 803A53858 40 JUDITH AUKSTOLIS
15426551 803A5385 |
|
u*****o 发帖数: 1224 | 30 诚心请教以下问题:
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 = 'RANC |
|
t*****n 发帖数: 167 | 31 1.A raw data file is listed below.
1---+----10---+----20---+---
son Frank 01/31/89
daughter June 12-25-87
brother Samuel 01/17/51
The following program is submitted using this file as input:
data work.family;
infile 'file-specification';
run;
Which INPUT statement correctly reads the values for the variable Birthdate
as SAS
date values?
a. input relation $ first_name $ birthdate date9.;
b. input relation $ first_name $ birthdate mmddyy8.;
c. input relation $ first_n |
|
F*******1 发帖数: 75 | 32 Site1 - Site1000 are character variables. If I put Site1-Site1000 $ in the
INPUT statement as shown below, only Site1000 is showing as character
variable. Can somebody help me this? Thanks a lot!
data WindSummary;
%let _EFIERR_ = 0; /* set the ERROR detection macro variable */
infile myfile delimiter = ',' MISSOVER DSD lrecl=102590 firstobs=2;
format DataItem $60. ;
INPUT DataItem $ Site1-Site1000 $;
run; |
|
c******j 发帖数: 270 | 33 写了这么一段code
LIBNAME Mylib 'C:\Documents and Settings\cloverzj\My Documents\SAS';
proc format lib=mylib;
value $itemfmt
'C'='Cassette'
'R'='Radio'
'T'='Television';
run;
data sasuser.orders;
infile aug99dat;
input ID 3. @5 Date date7.
Item $13 Quantity 15-17
Price 19-24 TotalCost 26-32;
format date date9. totalcost dollar9.2;
format Item $itemfmt.;
run;
proc print data=sasuser.orders;
run;
可是运行的时候总是说The format $ITEMFMT was not found or cou |
|
c*******o 发帖数: 8869 | 34 来自主题: Statistics版 - SAS问题 data a;
infile cards dlm=',';
input a b;
cards;
1,4
3,3
2,
4,
;
run;
data b;
set a(in=aa rename=(a=var1)) a(in=bb rename=(b=var1));
if aa then var2='a';
else var2='b';
if var1;
keep var1 var2;
run; |
|
c**********n 发帖数: 80 | 35 我在网上下载的SAS 9.1.3 安装在D盘里,在编写程序的时候用infile 'd:\abc\efg.
sas7bdat' 语句
时log里面总是说文件不存在。(路径没有错);
另外用到mmddyy10. 的format的时候说找不到这个format,是不是少装了一些功能呢?
我目前把sas完全
安装了还是不行,是不是要另外找补丁?能麻烦告知在哪里能下载么?
十分感谢! |
|
b*******g 发帖数: 170 | 36 use SET statement instead of INFILE statement, because the file in your disk
is the sas file. |
|
d*****n 发帖数: 65 | 37 第一个问题,你建个library就行了,infile都是导入非sas格式数据才用的。
第二个问题,你应该试试 yyyymmdd10. |
|
c**********n 发帖数: 80 | 38 谢谢~
对于第二个问题,我想把日期比如1/10/1960变成sas date:10
我的做法是直接input date mmddyy10. 但是说mmddyy10.的format找不到。mmddyyyy10
. 和mmddyyyy8.也是一样。
这种情况下怎么解决呢?BTW,yyyymmdd10. 不行。
我的数据是:
symbol date volume
symbol_1 10/12/1999 98
symbol_2 11/2/1999 2
symbol_3 6/15/1998 40
要求把date转换成sas date
log 如下:
1 data qqq;
2 set 'd:\sas\mysaslib\qp\arg';
3 input symbol $ volume;
4 run;
ERROR: No DATALINES or INFILE statement.
NOTE: The SAS System stopped processing this step be |
|
p********a 发帖数: 5352 | 39 你是初学者吧?
现成的SAS DATA是不需要INPUT的,你的SET语句也完全不对。建议你可以先学学
LIBNAME, SET, INFILE STATEMENT后再看看 |
|
c*********n 发帖数: 87 | 40 why do the outputs of two silimar programs are different?
(1) libname sasdata 'sas_data_library';
data test;
set sasdata.chemists;
if jobcode='chem2';
then description='senior-chemist';
else description='unknown';
run;
a value for jobcode is listed blow:
jobcode
chem2
output: description
unknown
(2)data test;
infile 'amount';
input @1 salary 6.;
if _error_ then description='problems';
else description='no problems';
run;
|
|
c*********n 发帖数: 87 | 41 why is the output so wield:
employee_name idnum age
ruth 22 .
sue . 40
why is the idnum of ruth not equal to 11?
why is the age of sue not equal to 30?
program is below:
data one;
infile 'C:\Users\jfang2\base sas\employee.txt';
input employee_name $ 1-4;
if employee_name='ruth' then input idnum 10-11;
else input age 7-8;
run;
raw data of employee.txt
ruth 39 11
jose 32 22
sue 30 33
john 40 44 |
|
I*****G 发帖数: 10 | 42 正在学习SAS。看到一个问题不太明白,请达人们指点一下。
data perm.people (drop=type);
infile census;
retain Address;
input type $1. @;
if type = 'H' then input @3 address $15.;
if type = 'P';
input @3 Name $10. @13 Age 3. @16 Gender $1.;
run;
data set (census):
H 321 S. MAIN ST
P MARY E 21 F
P WILLIAN M 23 M
H 324 S. MAIN ST
P PETER S 22 M
.
.
在完成一个INTERATION后,为什么没有OUTPUT呢?不是默认完成一个INTERATION就有么?
为什么要等到第二个INTERACTION才有第一个OBSERVATION? |
|
o******6 发帖数: 538 | 43 PROC IMPORT
datafile='K:\DATA ENTRY\P\Interviews\check.csv'
out=Pcheck
dbms=csv
replace;
getnames=yes;
datarow=2;
run;
那个dataset比较大,有4,5百个VARIABLE,而且很多VARIABLE是用来要SCORE的,
DATASET本身就需要CLEAN,已经花了我一些时间写MACRO来CLEAN和SCORE,比如有很多
DATE的VARIABLE,而DATE存的时候有些是8/ 9/2007,可是现在有个问题,我在SCORE的
时候发现有些VARIABLE被IMPORT后变成CHARACTER了,而且被TRUNCATE了,应该2位数的
变1位数了,上次EXCEL发现问题后CHANGE了WINDOWS REGISTRY WORK了,问题是我现在
还不知道怎么解决IMPORT CSV的问题,我不想用INFILE写,太花时间了,而且CODE又得
有变动,有没有人知道怎么解决这个问题呀,主要那个DATASET有好多DATA是MISSING,
应该也是 |
|
|
o******6 发帖数: 538 | 45 我不想INFILE呀,没有别的简单方法吗,不然4,500个VARIABLE太花时间了,而且我已
经做了一些CLEANING了。 |
|
l******n 发帖数: 9344 | 46 最简单的方法是让SAS自动产生infile的代码,所有的variable, informat or format都
会有,
然后自己改一下就好了 |
|
p********a 发帖数: 5352 | 47 What Data Steps?
太广了,就是infile/input/array/merge/if then/do-end所有的DATA STEP都用 |
|
s******d 发帖数: 303 | 48 我的数据有大约 150G, 是csv 形式的。我需要共里面取一些数据,但是如果先infile
这个大 data, 好像不太可能。
想问问版上的高人,有没有什么办法,直接从一个巨大的csv file 读取我想要得 记录
。我看了一下proc sql, 发现还是得 from .sasdataset.
先谢谢啦。 |
|