如何读取间距不均匀的数据? [英] How can I read in data with uneven spacings?

查看:43
本文介绍了如何读取间距不均匀的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据似乎没有一致的间距或定位.它看起来像:

I have data which doesn't appear to have consistent spacings or positioning. It looks like:

1675 C Street , Suite 201   
Anchorage   AK  99501   
61.205475   -149.886882
600 Azalea Road 
Mobile    AL      36609 
30.656824   -88.148781
1601 Harbor Bay Parkway , Suite 150 
Alameda   CA    94502   
37.726114   -122.240546
1900 Point West Way,  Suite 270 
Sacramento      CA  95815   
38.5994175  -121.4315844
3600 Wilshire Blvd., Suite 1500 
Los Angeles   CA    90010   
34.06153    -118.303463

我想从中提取街道地址、城市名称、州、邮政编码、纬度和经度.我认为下面的代码可以工作,但它产生了非常奇怪的结果.

From this I'd like to extract the street address, city name, state, zip code, lat, and long. I thought the following code would work, but it produces very weird results.

data voa;
    input Address $50.;
    input City $ State $ Zip;
    input Latitude Longitude;
    datalines;

我认为问题在于元素的间距或位置不一致.

I think the issue comes from the fact that there isn't consistent spacing or positioning of the elements.

推荐答案

您的数据可以使用 LIST 输入正常工作,您只需要添加查找双分隔符选项"&到 CITY 再加上它需要多一点 16 美元左右.

Your data will work fine using LIST input you just need to add the "look for double delimiter option" & to CITY plus it need to be a bit longer $16 or so.

input City &$16. State $ Zip;

这篇关于如何读取间距不均匀的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆