Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 To: Michael Landrup
  Where is Michael Landrup?
 
 Vietnam
 Michael Landrup
 Tags
Subject: RE: how to synthetic data?
Thread ID: 345281 Message ID: 345489 # Views: 42 # Ratings: 1
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Wednesday, May 23, 2012 8:25:22 PM         
   


> I have 3 tables of data as shown below. I want a summary of them as only three tables sum up the difference. ask experts for help. thank you very much!


Put you sixty tables into one:

SELECT * FROM Cn1 INTO CURSOR Q1
FOR i = 2 TO 60
 tablename='cn'+TRANSFORM(m.)
 INSERT INTO Q1 SELECT * FROM (m.tablename)
NEXT

Suppose this is your data in Q1
Code Value
1 A
1 B
1 X
1 A
1 C
2 A
2 B
2 C
2 A
2 D

SELECT code, value, value FROM Q1 GROUP BY 1,2,3 ORDER BY 1,2 INTO CURSOR Q2 
DO (_genxtab) WITH 'xtab' 
BROWSE LAST NOWAIT
The result of the cosstabulation is:
    
Code A B C D X
1 A B C X
2 A B C D


If the looks you fancy matter:
COPY TO xx.txt DELIMITED WITH "" WITH CHARACTER '/'
MODIFY FILE xx.txt

Result :
1/A/B/C/ /X
2/A/B/C/D/

and that in turn can be further prettyfied and imported into a table with two columns.
-Anders

ENTIRE THREAD

how to synthetic data? Posted by Michael Landrup @ 5/22/2012 6:24:11 AM
RE: how to synthetic data? Posted by Anders Altberg @ 5/22/2012 12:46:23 PM
RE: how to synthetic data? Posted by Cetin Basoz @ 5/22/2012 1:45:29 PM
RE: how to synthetic data? Posted by Michael Landrup @ 5/22/2012 4:11:34 PM
RE: how to synthetic data? Posted by Cetin Basoz @ 5/22/2012 7:04:29 PM
RE: how to synthetic data? Posted by Michael Landrup @ 5/23/2012 6:30:58 AM
RE: how to synthetic data? Posted by Cetin Basoz @ 5/23/2012 11:29:30 AM
RE: how to synthetic data? Posted by onytoo @ 5/22/2012 6:20:15 PM
RE: how to synthetic data? Posted by Michael Landrup @ 5/23/2012 4:21:42 AM
RE: how to synthetic data? Posted by Anders Altberg @ 5/23/2012 8:25:22 PM
RE: how to synthetic data? Posted by Michael Landrup @ 5/24/2012 5:21:22 AM